using the Nginx echo Agent in Ubuntu to configure multiple sites under one port
Under a server, there is no domain name, multiple domain name is easy here do not do too much description.
The IP of a server is as follows: 192.168.1.101 default Niginx 80 port. Project directory under/var/www/html we create another project directory in/var/www/wecaht
If we have access to 192.168.1.101/wechat we need to configure the following:
I still need another port, like 8001. Create a new profile under/etc/nginx/sites-available WeChat
listen 8001;
server_name wechat.com;
Root/var/www/wechat;
Index index.php index.html index.htm;
# make site accessible from http://localhost/
server_name localhost;
Location ~* \. (Eot|otf|ttf|woff) $ {
add_header Access-control-allow-origin *;
}
Location/{
# attempt to serve request as file, then
# as directory, then fall back to displaying a 404.< C14/>try_files $uri $uri//index.php $args;
# Uncomment to enable NAXSI on this location
# include/etc/nginx/naxsi.rules
}
Ln-s/etc/nginx/sites-available/etc/nginx/sites-enable/wechat
Create a soft connection
Save Launch service Nginx restart
Visit 192.168.1.101:8001 we will visit the PHP project in the WeChat directory
Now we add the reverse proxy to the default profile/etc/nginx/sites-available/default
location/wechat/{
Proxy_pass http://192.168.1.101:8001;
}
Then restart the Nginx server
Visiting Http://192.168.1.101/wechat is OK.