One, Samba (similar to shared network disk)
1, Function: Linux operating system to win users to share files with
2. How to Deploy
"Preparation Environment: Iptables–f (Clear firewall), Systemctl disable FIREWALLD (boot default off), Systemctl stop Firewalld (immediate shutdown), SYSTEMCTL status Firewalld (view firewall status)
About SELinux Modifications: setenforece 0 (temporarily modified), Getenforce (View status)
"Configure IP address (install package)
Open service Systemctl start Smb,systemctl status SMB (View status), create System User (Useradd), Sambpasswd–a user name (added to samba user)
With the win computer right-click (Map Network Driver), \ \ own IP address \ Username
"Modify the configuration file
Do a mounted hard disk directory, and then only exist in the directory of share in which hard disk
Vim/etc/samba/smb.con Ctry+v into the visualization block, select the upper and Lower keys, press D to delete
Path followed by the specific file/share, save exit
No permissions, ll–d query own permissions, modify permissions chmod o+w share
The write list is open to some users, as long as the Writable=no is closed first
Change to a user who cannot log into the operating system
"Start service
Systemctl Restart SMB (restart service)
"Test
Map Network drivers
\ \ server ip\ user name--log in to the user's home directory
\ \ server ip\public--log on to the shared directory
NET use #查看 net use */del cleanup
Second, Nginx (one of the Web services provided)
1, binary installation: Yum install nginc through yum installation, if not, first install the expansion pack yum install Epel-release–y
Install via source package: Install the Yum install gcc-* glibc-* pcre-y before installing and unpack
./configure–sbin path Specifies the Sbin directory,--conf-path Specifies the configuration file,--pid-path specifies the process PID number
./configure--prefix=/usr/local/nginx (Specify installation path)
The solution after the error:
./configure--prefix=/usr/local/nginx--with-pcre=/usr/lib64
./configure--prefix=/usr/local/nginx--without-http_rewrite_module
2. Start Nginx command
/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
PS aux |grep nginx (view nginx process) Netstat–an |grep 80 (view Nginx via port filtering)
/usr/local/nginx/sbin/nginx–s Stop (OFF)
/usr/local/nginx/sbin/nginx–s Reload (do not close, reload config file)
3. Modify the configuration file
Open vim/usr/local/nginx/conf/nginx.conf,
Through the PS aux |grep nginx |grep–v grep query work process (reverse, only see the results related to Nginx)
After changing the number of workers, you want the configuration to take effect, perform/usr/local/nginx/sbin/nginx–s reload, and then view the PS aux |grep nginx |grep–v grep
How much work a worker process can receive at the same time (only software-level configuration, hardware must also meet the conditions)
HTTP has a lot of optimized parameters, dynamic view Log Tail–f/uer/local/logs/access.log
HTTP is a global configuration, server is a local configuration (takes precedence)
Supplemental Status code: 200 Access successful, 3 start redirect, 4 Start is client problem, 5 start is server problem
4. Test results
Enter the IP address in the browser, switch to Cd/usr/local/nginx, browse to see the HTML directory (user browsing information from the file in this directory), Echo ' test====== ' > html/ A.txt, there is a default file index.html
Third, the reverse proxy to achieve load balancing
1, Nginx reverse proxy, three kinds of agents: Forward proxy (request directly to the agent, Proxy return Web page), reverse proxy, transparent proxy (the request is restricted by the agent, the user does not know the existence of the agent)
2, Reverse proxy work principle: A reverse proxy server behind a lot of servers to receive user requests, the user's request only the reverse proxy know, the final reverse proxy server to distribute the request to the back of the server, to achieve load balancing
3, Reverse proxy configuration (enter Nginx.org official website to view)
Cd/usr/local/nginx
Build Catalog: Mkdir/server1 mkdir/server2 Mkdir/server3
Web file: Echo ' server1 ' >/server1/index.html
echo ' Server2 ' >/server1/index.html
echo ' Server3 ' >/server1/index.html
Each to customize the configuration file, each start a Web port different, build a unified configuration file mkdir/ndinx_conf, CP/USR/LOCAL/NGINX/CONF/NGINX.CONF/NGINC_CONF/WEB1.CONF,CP/ usr/local/nginx/conf/nginx.conf/nginc_conf/web2.conf,cp/usr/local/nginx/conf/nginx.conf/nginc_conf/ web3.conf Copy to your own path, and then modify the following configuration file by one
And so on, modify WEB2/3
Then execute the web1,/usr/local/nginx/sbin/nginx–c/nginx_conf/web1.conf and find the error
Vim web1.conf Modification
WEB2/3 All to modify this
NGINX_CONF has 3 Web configuration files, LB also needs to have its own profile, CP web3.conf lb.conf,
Vim lb.conf first corresponds to the port and joins the up stream in HTTP
Then execute, see the effect is every refresh once the page display results change, and then continue to modify
2 is the continuous display 2 times, 3 is 3 times, does not write is 1 times
And then start again.
DAY-9 Linux Basics and Common commands (5)