nginx安装:
解这两种代理的关键在于代理服务器所代理的对象是什么,正向代理代理的是客户端,我们需要在客户端进行一些代理的设置。而反向代理代理的是服务器,作为客户端的我们是无法感知到服务器的真实存在的。
正向代理代理客户端,反向代理代理服务器。**
nginx的下载 http://nginx.org/en/download.html
安装编译工具
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
yum -y install pcre pcre-devel
nginx 在路径/usr/local/src/nginx-1.18.0下载
wget http://nginx.org/download/nginx-1.18.0.tar.gz
解压
tar -zxvf nginx-1.18.0.tar.gz
进入文件夹,执行命令
cd nginx-1.12.0
./configure
安装完成显示信息:
Configuration summary:
+ using system PCRE library
+ OpenSSL library is not used
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx modules path: "/usr/local/nginx/modules"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
编译 :查看版本
make && make install pcre-config --version
查看nginx地址 whereis nginx 在usr/local/nginx
./sbin/nginx -v 查出nginx版本
查看端口情况 ps -ef列出进程列表,然后通过grep过滤,
ps -ef|grep nginx
usr/local/下面
chmod +x nginx
/usr/local/nginx/conf下的 配置nginx.conf
解决Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid" failed(2:No such file or directory)
执行命令: /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 使用nginx -c的参数指定nginx.conf文件的位置
解决:still could not bind() 端口被占用
netstat -ntlp|grep 80 kill -9 pid
查看帮助
/usr/local/nginx/sbin/nginx -h
停止,重启 quit,reopen
/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx -s reload