0
点赞
收藏
分享

微信扫一扫

通过Nginx代理一台服务器 实现多个域名访问同一IP地址

郝春妮 2022-06-28 阅读 24

问题描述


需要实现的是 多个域名访问同一服务器ip:80端口
默认http://域名.com是80端口
在项目中需要使用域名访问,不可能让人使用一串难输入的数字去访问你的网站


解决方法


这里就需要用到nginx代理服务
以下贴主要配置


server
{
listen 80;
server_name www.域名.com;
index index.html index.htm index.php;

#error_page 404 /404.html;
include enable-php.conf;

location / {
proxy_pass http://IP地址;
}
}
server {
listen 80;
server_name www.域名.com;
index index.html index.htm index.php;

#error_page 404 /404.html;
location / {
proxy_pass http://IP地址;
}
}


举报

相关推荐

0 条评论