Ngix使用方法
Linux下安装Nginx
1、使用yum安装Nginx(这种方法比较简便,就一条命令就ok)
如果出现Complete! 表示安装成功
2、查看Nginx版本
nginx -v
3、启动Nginx
nginx
4、查看端口
netstat -ntlp
5、此安装方法下 nginx一些主要文件的默认位置:
nginx配置路径:/etc/nginx/
日志目录:/var/log/nginx/
默认站点目录:/usr/share/nginx/html
PID目录:/var/run/nginx.pid
nginx常用命令:
nginx -v 查看版本
nginx 启动
nginx -s stop 停止
nginx -t 检查配置nginx.conf后语法是否正确
nginx -s reload 重启
Nginx修改默认的80端口:
如果版本比较低的话,nginx.conf中是看不到监听80端口的配置信息的代码的,但是有一个include
# Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf;
在/etc/nginx/conf.d 目录下就可以找到default.conf 在该文件中可修改端口
注意:
listen 8066 default_server;
# listen [::]:8066 default_server;
listen [::]:8066 default_server; 这一行是IPV6端口 阿里云服务器不支持IPV6端口的设置
暴力点的处理方法就是把它注了

浙公网安备 33010602011771号