The nginx secondary directory corresponds to multiple static projects
When testing and developing locally, nginx wants to use only one port, but wants to correspond to multiple static projects (such as VUE, PHP, etc.)
1. Create a main folder, such as: /data/www/front
/data/www/front
2. Create multiple subdirectories under the folder, such as vue-front, php-front
in the following form:
/data/www/front/vue-front
/data/www/front/php-front
The nginx settings are as follows:
server {
listen 1000;//端口设置
server_name localhost;//域名、ip设置
root /data/www/front; //此处填写项目文件夹
}
When accessing the link, directly:
#访问vue项目
http://localhost:1000/vue-front
#访问php项目
http://localhost:1000/php-front