下载nginx包,上传到服务器
安装包
nginx/Windows-1.22.0 pgp |
在nginx.conf中配置
端口号9527
服务器ip:server_name
打包后的文件夹dist放在html文件夹下
公共路径/api/
数据地址proxy_pass
--------------------
打包后的文件夹dist放在html文件夹下
--------------------
输入服务器IP:端口号 /api/
请求到数据
-----------------------
请求数据接口,
---------------------
打开项目
server {
listen 9527;
server_name 123.57.13.12;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html/dist;
index index.html index.htm;
}
location /api/ {
proxy_pass https://x.dscmall.cn;
}
#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;
#}
}