安装
sudo apt-get install nginx
启动、重启、停止、状态
sudo /etc/init.d/nginx start
sudo /etc/init.d/nginx restart
sudo nginx -s reload
sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx status
擦看端口占用
lsof -i:80
启动
nginx -c /usr/local/nginx/conf/nginx.conf
测试nginx.conf文件
nginx -t -c /etc/nginx/nginx.conf
目录详情
名称 | 目录 |
---|---|
配置文件 | /usr/local/nginx/conf/nginx.conf 或 /etc/nginx/nginx.conf |
程序文件 | /usr/local/nginx/sbin/nginx 或 /usr/sbin/nginx |
日志 | /var/log/nginx |
默认虚拟主机 | /var/www/ |
命令详情
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-T : test configuration, dump it and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /usr/share/nginx/)
-c filename : set configuration file (default: /etc/nginx/nginx.conf)
-g directives : set global directives out of configuration file