nginx -t -c /etc/nginx/nginx.conf
检查配置文件是否正确
nginx -s stop
nginx -c /etc/nginx/nginx.conf
默认安装路径使用以下命令
/usr/local/webserver/nginx/sbin/nginx -t # 测试配置文件语法正确
/usr/local/webserver/nginx/sbin/nginx -s reload # 重新载入配置文件
/usr/local/webserver/nginx/sbin/nginx -s reopen # 重启 Nginx
/usr/local/webserver/nginx/sbin/nginx -s stop # 停止 Nginx
server {
listen 80;
server_name www.yansl.com;
root /root/dist;
index index.html;
location / {
root /root/dist;
try_files $uri $uri/ /index.html last;
index index.html;
}
}
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
#gzip on;
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
#upstream mobile_page {
# server localhost:8081 weight=1;
# ip_hash;
#}
#tcp_nopush on;
#keepalive_timeout 0;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
网友评论