摘要:转发接着上篇文章说添加以下内容映射端口映射地址你要转发的地址做文件服务器你的服务器文件地址重启
Nginx转发
接着上篇文章说
cd /usr/local/nginx/conf/vhost vi ***.***.com.conf
添加以下内容
server {
listen 80; # 映射端口
autoindex on;
server_name ***.com; # 映射地址
access_log /usr/local/nginx/logs/access.log combined;
index index.html index.htm index.jsp index.php;
#error_page 404 /404.html;
if ( $query_string ~* ".*[;"<>].*" ){
return 404;
}
location / {
proxy_pass http://127.0.0.1:8080; # 你要转发的地址
add_header Access-Control-Allow-Origin *;
}
}
Nginx做文件服务器
server {
listen 80;
autoindex off;
server_name ***.com;
access_log /usr/local/nginx/logs/access.log combined;
index index.html index.htm index.jsp index.php;
#error_page 404 /404.html;
if ( $query_string ~* ".*[;"<>].*" ){
return 404;
}
location / {
root /ftpfile/; # 你的服务器ftp文件地址
add_header Access-Control-Allow-Origin *;
}
}
重启Nginx
/usr/local/nginx/sbin/nginx -s reload
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/39634.html
阅读 4188·2021-10-08 10:05
阅读 3198·2021-09-27 13:57
阅读 2913·2019-08-29 11:32
阅读 1296·2019-08-28 18:18
阅读 1568·2019-08-28 18:05
阅读 2179·2019-08-26 13:39
阅读 1100·2019-08-26 11:37
阅读 2234·2019-08-26 10:37