1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > nginx使用子域名绑定到指定端口

nginx使用子域名绑定到指定端口

时间:2018-07-20 01:30:31

相关推荐

nginx使用子域名绑定到指定端口

安装nginx,使用下面网站的方式一

链接

添加配置

cd/etc/nginx/conf.d

vi api.conf

server {

listen 80;#监听端口

root /usr/******/springboot/static/; #网站根目录,建议使用绝对路径

index index.php index.html index.htm; #默认文件

location / {

root /usr/******/springboot/static/;

index index.html index.htm index.php;

}

}

server {

server_name ;

location / {

proxy_pass http://127.0.0.1:8080;

}

}

:wq!

上面就是80端口开始一个网站,代理到8080服务

重启服务

systemctl restart nginx

访问页面

访问服务

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。