One IP, multiple websites, how to configure?
ubuntu 14.04 nginx 1.80 php5-fpm
When a website is working normally, when adding another configuration file to sites-available, all of them are inaccessible. Please tell me how to configure it correctly
怪我咯2017-05-16 17:23:47
Configure virtual host:
You can refer to my blog: http://xxgblog.com/2015/05/17/nginx-start/ 4. Virtual host
server {
listen 80 default_server;
server_name _;
return 444; # 过滤其他域名的请求,返回444状态码
}
server {
listen 80;
server_name www.aaa.com; # www.aaa.com域名
location / {
proxy_pass http://localhost:8080; # 对应端口号8080
}
}
server {
listen 80;
server_name www.bbb.com; # www.bbb.com域名
location / {
proxy_pass http://localhost:8081; # 对应端口号8081
}
}
伊谢尔伦2017-05-16 17:23:47
Each website runs a different port and then reverse-proxyes to each port through the domain name
For example,
abc.com is in 3001
xyz.com is in 3002
nginx runs 80 and reverse proxy to 3001 and 3002 according to the domain name
The idea is here, the specific configuration of the search engine
ringa_lee2017-05-16 17:23:47
It is to configure different servers, and then server_name corresponds to the domain name of the website.