A, nginx basic operation
1, the installation: yum install nginx
(1) add resources: sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
(2) start the download installation: sudo yum install -y nginx
2, start: service nginx start
(1) View process: ps -ef | grep nginx
3, stop: service nginx stop
4, overloading: service nginx reload (important when using nginx configuration modification does not affect the operation of the line item)
Note: Enter the installation path: Under cd / etc / nginx, you can view profiles
View network processes: sudo netstat -anpl | grep "nginx"
Viewing the Access Log: sudo tail -f /var/log/nginx/access.log
Two, Nginx expand knowledge
1, Web Hosting
Enter: sudo vim /etc/nginx/conf.d/ttt.conf
Ttt.conf configuration file, but you need to be modified in the machine: sudo vim / etc / hosts file, add the virtual domain names ip is mapped ~~~
Native:
The configuration file on the server:
2, multi-domain, multi-port
Listen for a plurality of listening ports in the configuration file as shown above! ! !
3, pseudo-static
In the configuration file, add:
location / {
rewrite ^(.*)\.htmp$ /index.html;
}
Those who visit htmp suffix are index.html
4, the log format
First, view the log: sudo tail -f /var/log/nginx/access.log
View Profile: sudo vim /etc/nginx/nginx.conf
In the configuration file to customize the log in ttt.conf
Use: tail -f / var / log / nginx / tail -f access_test.log view the output log! ! !
5, reverse proxy and load balancing
Reverse Proxy:
Load Balancing:
6, debugging techniques
7, see the nginx state, the reality out wrong information
sudo systemctl status nginx.service
Reproduced in: https: //www.jianshu.com/p/6c037759c533