Home  >  Article  >  Operation and Maintenance  >  Linux Basics--Use Linux Correctly

Linux Basics--Use Linux Correctly

PHP中文网
PHP中文网Original
2017-06-20 11:13:351984browse

1. Samba service

The Samba service is mainly used for Linux servers to share files with Windows users.

Configuring the server requires the following 5 steps

1. Prepare the environment

1) Turn off the firewall systemctl stop firewalld

2) Temporarily turn off selinux sentenforce 0

or permanently turn off selinux in the configuration file

vim /etc/ sysconfig/selinux selinux=disabled

2. Configure IP

Make sure the current IP is available, otherwise reconfigure an available IP yourself

3. Install the software package

1) Binary installation yum install samba

2) Source code installation

a) Download the source code package from the official website

b) After installing the lrzsz tool, you can directly compress the downloaded file Drag the package to Linux

 Unzip, tar xvf compressed package name

 c) Install gcc and glibc compilation tools yum install gcc-* glibc-* -y

 d) cd to the installation and decompression directory, configure, ./configure --prefix=/usr/local/samba

e) Compile make

f) Execute make install

##3) Modify the configuration file

The configuration file is in /etc/samba/samba.conf

We create a new hard disk to store the shared files and mount it to /share

vim /etc/samba/samba.conf 

[public]                             #第一行是用户名,客户端通过这个来识别/path = /share  
        comment = Public Stuff
        path = /share                #分享文件的路径public = yes
        writable = yes               #改成yes,否则没有写权限printable = no
        write list = +staff          #可写列表,可以选择哪些用户具有写权限,默认是所有用户-- 插入 --
Don’t forget to restart the service after saving and exiting

4) Start the service

a) Binary installation Yes, use systemctl start smb to start the Samba service

. To shut down the service, use systemctl stop smb

. To restart, use systemcrl restart smb

. b) For source code installation, use /usr/local /samba/bin/samba -c /usr/local/samba/conf/samba.conf

To shut down the service, use /usr/local/samba/bin/samba -s /usr/local/samba/conf/ samba.conf

Restart is /usr/local/samba/bin/samba -s reload

5) Test

Create a system user, such as useradd zhangcan

Add password, smbpasswd -a zhangcan

Find "Map Network Drive" on the Windows computer --> Enter the mapped folder according to the example, such as \\192.168.0.111\zhangcan

Then a login interface will pop up. You can log in with the system user and password you just created.

2. Nginx service

1.nginx is a high-performance HTTP and reverse proxy The server can handle high concurrent access and can also be used for load balancing.

The process of configuring Nginx is the same as the process of configuring the Samba service above, so it will not be repeated. Note that epel-release must be installed before installing Nginx. These are some extended packages.

View the commands containing the nginx process: ps aux |grep nginx

To kill a process, use kill -9 uid

After starting the nginx service, you can enter the local IP in the browser address bar to access the nginx welcome interface

The content of this welcome interface is /usr/local/nginx/html File

2. Use nginx to simulate load balancing

1) Start four virtual machines, install nginx services respectively, and obtain IP addresses. One of them serves as a proxy server, and the other three As a web server

 2) Modify the configuration file of the proxy server, vim /usr/local/nginx/conf/nginx.conf

  Modify two places

/octet-server 192.168.16.140;                           server 192.168.16.71192.168.16.182
 location / {
                        proxy_pass http://nginx_webs;                    
        }
You can modify the /usr/local/nginx/html/index.html file in the web server, for example, change it to 1, 2, and 3 respectively, and you can see the effect in the browser , the number will change every time it is refreshed, proving that the browser distributes access requests to these three web servers.

The above is the detailed content of Linux Basics--Use Linux Correctly. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn