社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
http://nginx.org/en/download.html
有很多种方法启动nginx
(1)直接双击nginx.exe,双击后一个黑色的弹窗一闪而过
(2)打开cmd命令窗口,切换到nginx解压目录下,输入命令 nginx.exe 或者 start nginx ,回车即可
直接在浏览器地址栏输入网址 http://localhost:80,回车,出现以下页面说明启动成功
如果使用cmd命令窗口启动nginx,关闭cmd窗口是不能结束nginx进程的,可使用两种方法关闭nginx
(1)输入nginx命令 nginx -s stop(快速停止nginx) 或 nginx -s quit(完整有序的停止nginx)
(2)使用taskkill taskkill /f /t /im nginx.exe
server {
listen 8090; // 监听的端口
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root F:XZYimportData; // 本地文件的路径
index index.html index.htm; // 访问index首页的文件
}
location /v1/ { // nginx会将带/v1/请求转发到https://api-dmp.swellfun.com
# rewrite ^/v1/(.*)$ /$1 break;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://api-dmp.swellfun.com; // 这里填上服务器地址(你要nginx替你转发的接口地址)
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ .php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# deny all;
#}
}
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!