下载nginx
windows上是个压缩包
解压后, 使用命令行输入 nginx 进行启动
nginx -s stop
进行停止
nginx -s status
查看状态
可以配置一下环境变量
主要是配置文件, windows的nginx配置文件在 conf文件夹下
在http标签下 添加如下配置
其他地方不用更改,保持原样即可,
以下是整个配置文件的参考
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#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;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name example.com;
root G:\media;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
}