我在一个域上为几个页面配置nginx时遇到问题。例如,我们有example.com。这个页面允许你购买一些商品,但我想分开各大洲的网页。所以我创造了 / usr / share / nginx / europe,/ usr / share / nginx / asia每个文件夹都拥有文件,数据库等。我正在尝试配置它,但我不知道如何。 我应该制作一些子域名吗?我不能用例如: example.com/asia example.com/europe 在/ etc / nging / sites-enabled中我创建了两个欧洲和亚洲文件:
server {
listen 80;
root /usr/share/nginx/europe;
index index.html index.htm index.php;
server_name example.com/europe;
access_log /var/log/nginx/test1_access.log;
error_log /var/log/nginx/test1_error.log;
location /blog.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name;
}
}
server {
listen 80;
root /usr/share/nginx/asia;
index index.html index.htm index.php;
server_name example.com/asia;
access_log /var/log/nginx/asia_access.log;
error_log /var/log/nginx/asia_error.log;
location /blog.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name;
}
}