nginx
2015-04-20 22:31 Wizardlsw 阅读(285) 评论(0) 编辑 收藏 举报在LINUX下查看IP命令: ip addr show
http://ju.outofmemory.cn/entry/46060
http://stackoverflow.com/questions/5009324/node-js-nginx-and-now
https://www.ionos.com/community/server-cloud-infrastructure/nginx/solve-an-nginx-403-forbidden-error/
Install Nginx 安装Nginx
方法1:
首先,设置yum repository
https://www.nginx.com/resources/wiki/start/topics/tutorials/install/
To add NGINX yum repository, create a file named /etc/yum.repos.d/nginx.repo
and paste one of the configurations below:
CentOS: ($releasever 对应需要修改成:CentOS的版本,比如5, 5.x, 6,6.x, 7)
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
正式安装
yum install nginx
nginx常用目录
1 配置所在目录:/etc/nginx/
2 PID目录:/var/run/nginx.pid
3 错误日志:/var/log/nginx/error.log
4 访问日志:/var/log/nginx/access.log
5 默认站点目录:/usr/share/nginx/html
方法2:
下载:
# wget http://nginx.org/download/nginx-1.6.3.tar.gz
解压与安装:
# tar -zvf nginx-1.6.3.tar.gz
# cd nginx-1.6.3
# ./configure
# make
# make install
操作Nginx
https://www.nginx.com/resources/wiki/start/topics/tutorials/commandline/
Start / Stop / Restart Nginx Web Server http://www.cyberciti.biz/faq/freebsd-start-stop-restart-nginx-webserver/
启动
# nginx
# sudo service nginx start
重启
# nginx -s reload
# sudo service nginx restart
停止
# nginx -s stop
# sudo service nginx stop
或者
# kill -s QUIT <PID>
注: PID 指 nginx 的master进程号
或者: #kill -QUIT $(cat /var/run/nginx.pid)
检测配置文件(同时可以看到使用的配置文件具体路径)
# nginx -t
查看对应进程: # ps aux | grep nginx
查看端口:netstat -apn
[slin@iZwz9h33t7dnsizrtbp8yhZ www]$ netstat -apn | grep 80
(No info could be read for "-p": geteuid()=1000 but you should be root.)
tcp 0 0 172.18.73.200:49674 140.205.140.205:80 ESTABLISHED -
tcp 401 0 172.18.73.200:37354 106.11.68.13:80 CLOSE_WAIT -
unix 3 [ ] DGRAM 63380 -
CentOS 7: ifconfig command not found
http://my.oschina.net/u/1428349/blog/288708
Errors:
# 502 Bad Gateway
https://stackoverflow.com/questions/23948527/13-permission-denied-while-connecting-to-upstreamnginx
配置反向代理:
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.2
502 Bad Gateway 错误: https://stackoverflow.com/questions/23948527/13-permission-denied-while-connecting-to-upstreamnginx
配置证书Install Certificate/SSL Certificate
https://www.cnblogs.com/beyang/p/7718463.html (tried on 2019.1.13, works very well, and TLS SNI supported in already)
https://sg.godaddy.com/zh/help/centos-7-nginx-27192 (not tried yet)
https://help.aliyun.com/knowledge_detail/95491.html?spm=5176.2020520154.cas.39.5a7256a77CXIC1 (not tried yet)