OK let’s using nginx to proxy your server
nginx is very popular proxy server , most companies are using this server to proxy their application,
so let’s move to it and learn how to use it
ok plz make sure you have already install centos7 or other unix os
Preparation work :
ssh root@yourIpAddress and login in your system
cd /
mkdir -p /test/nginx
mkdir -p /test/nginx/nginxStart
cd /test/nginx
1.wget http://nginx.org/download/nginx-1.15.0.tar.gz
2.unzip this file such as commond tar -zxvf nginx-1.15.0.tar.gz
3.cd nginx-1.15.0
4.Use the default configuration ./configure
5.or custom configuration (not recommended) so let’s use custom configuration
6./configure –prefix=/test/nginx/nginxStart
7.make && make install
8.start or stop nginx server
启动、停止nginx
cd /test/nginx/nginxStart/sbin/
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
./nginx -s quit:此方式停止步骤是待nginx进程处理任务完毕进行停止。
./nginx -s stop:此方式相当于先查出nginx进程id再使用kill命令强制杀掉进程。
9.show nginx pid
ps -ef|grep nginx
ok you are successfully to install nginx server
10.重启 nginx
10.1.先停止再启动(推荐):
对 nginx 进行重启相当于先停止再启动,即先执行停止命令再执行启动命令。如下:
./nginx -s quit
./nginx
10.2.重新加载配置文件:
当 ngin x的配置文件 nginx.conf 修改后,要想让配置生效需要重启 nginx,使用-s reload不用先停止
ngin x再启动 nginx 即可将配置信息在 nginx 中生效,如下:
./nginx -s reload
启动成功后,在浏览器可以看到这样的页面:
nginx-welcome.png
开机自启动
即在rc.local增加启动代码就可以了。
vi /etc/rc.local
增加一行 /test/nginx/nginxStart/sbin/nginx
设置执行权限:
chmod 755 rc.local
next look how to Setting up the configuration file—————- nginx.conf
cd /test/nginx/nginxStart/conf
vim nginx.conf
you wii see