-
LINUX install NGINX
- Install dependencies
-
yum install gcc
-
yum install pcre-devel
-
yum install zlib zlib-devel
-
yum install openssl openssl-devel
-
// One-click installation of the above four dependencies yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
-
- Download the tar package of nginx
-
// Create a folder cd /usr/ local mkdir nginx cd nginx // download tar package wget http://nginx.org/download/nginx-1.13.7.tar.gz tar -xvf nginx-1.13.7.tar.g
-
- install nginx
-
// Enter the nginx directory cd /usr/local/ nginx // Execute the command ./configure
-
// Execute the make command make // Execute the make install command make install
-
- Nginx common commands
-
// Test configuration file /nginx/sbin/nginx -t under the installation path
-
//启动命令 安装路径下的/nginx/sbin/nginx //停止命令 安装路径下的/nginx/sbin/nginx -s stop 或者 : nginx -s quit //重启命令 安装路径下的/nginx/sbin/nginx -s reload
-
//查看进程命令 ps -ef | grep nginx
-
//平滑重启 kill -HUP Nginx主进程号
-
- 配置防火墙
-
//打开防火墙文件 sudo vim /etc/sysconfig/iptables //新增行 开放80端口 -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT //保存退
-
//重启防火墙 sudo service iptables restart
-
- Nginx虚拟域名配置及测试验证
-
// Edit nginx.conf sudo vim /usr/local/nginx/conf/nginx.conf // Add the line include vhost /* .conf // save and exit
-
// Create a new vhost folder in the /usr/local/nginx/conf directory mkdir vhost //Create a configuration for each domain name sudo vim jimisun.com.conf //Add response configuration port forwarding or access file system to the node
-
- Nginx starts
-
// Enter the nginx installation directory cd sbin sudo ./nginx
- test access
http: // ip address
-
Miscellaneous experts are not as good as experts, keep improving