安装Nginx依赖环境和库:
1、查看openssl是否安装:
openssl version -a
2、查看是否安装pcre,安装会显示版本, 没安装什么都不显示:
rpm -qa pcre
3.是否安装zlib库:
yum list installed | grep zlib*
下载:
wget https://nginx.org/download/nginx-1.9.9.tar.gz
解压
tar -zxvf nginx-1.9.9.tar.gz
##进入nginx目录
cd nginx-1.9.9
配置
./configure --prefix=/usr/local/nginx
make
make
make install
cd到刚才配置的安装目录cd /usr/local/nginx/
./sbin/nginx -t
cd /usr/local/nginx/sbin
./nginx //启动nginx
查看进程:
ps aux | grep nginx
启动:/usr/local/nginx/sbin/nginx
停止/重新加载:/usr/local/nginx/sbin/nginx -s reload (stop,quit、reload)
验证配置文件是否合法:/usr/local/nginx/sbin/nginx -t
命令帮助:/usr/local/nginx/sbin/nginx -h
配置nginx开机自启动
vim /etc/rc.d/rc.local
查看端口号
netstat -ntlp //查看当前所有tcp端口·
netstat -ntulp |grep 6379 //查看所有1935端口使用情况·
//-----------------nginx反向代理-----------------
https://www.nginx.cn/927.html
nginx反向代理的三种模式:
https://blog.csdn.net/AV_woaijava/article/details/101277947
nginx反向代理无法加载静态资源问题:
location ~.*.(css|js|jpg) {
# 需要注意两点:1.proxy_pass的值不能有 / ,2.也不能有uri
proxy_pass http://127.0.0.1:8080;
}
参考
https://www.cnblogs.com/IT-Crowd/p/14192139.html
https://blog.csdn.net/weixin_45517110/article/details/112904784?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6.control