nginx 域名绑定

如何使用nginx绑定域名

养鱼的猫咪
3423
2021-03-05 14:59:37
栏目: 云计算

nginx绑定域名的方法:1.在nginx安装目录打开nginx.conf配置文件;2.在文件中将server_name的值修改为需要绑定的域名即可;

如何使用nginx绑定域名

在nginx中绑定域名的方法

1.首先,在计算机中进入到nginx安装目录,并查看到nginx.conf配置文件路径;


nginx -t


2.查看到nginx.conf配置文件路径后,将nginx.conf文件打开;


vim nginx.conf


3.最后,nginx.conf文件打开后,在文件中server_name的值修改为需要绑定的域名即可;


server{


listen 80;


server_name www.baidu.com; #绑定www.baidu.com域名


location /


{


proxy_set_header Host $host;


proxy_set_header X-Real-Ip $remote_addr;


proxy_set_header X-Forwarded-For $remote_addr;


proxy_pass http://127.0.0.1:18083;


}


}



0
看了该问题的人还看了