常用命令
-
nginx -V
查看版本
-
start nginx
启动Nginx
-
nginx -s stop
快速停止或关闭
-
nginx -s quit
正常停止或关闭
-
nginx -s reload
重新加载配置文件
配置静态网站
server {
listen 80;
server_name mytestdoamin.com;
location / {
root d:/html;
index index.html;
}
}
配置反向代理
server {
listen 80;
server_name auto.mytestdoamin.com;
location / {
proxy_pass http://127.0.0.1:9000;
proxy_set_header XHost $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
配置静态资源(目录显示)
server {
listen 80;
server_name 127.0.0.1;
location / {
root d:/static;
autoindex on;
autoindex_format html;
autoindex_exact_size off;
autoindex_localtime on;
charset utf-8;
}
}
网友评论