今日、これに関する記事をたくさん読みましたが、何が間違っているのかわかりません。2 つの Web サイト (site1.com、site2.com) を一緒に配置するために、nginx で 1 つの vps を使用しようとしています。
ここに私のnginx.confがあります
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
conf.d ディレクトリは空で、sites-enabled ディレクトリに私の設定があります:
server {
listen 80 default;
root /home/site1/www;
access_log /home/site1/logs/nginx.access.log;
server_name site1.com;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
と
server {
listen 80;
root /home/site2/www;
access_log /home/site2/logs/nginx.access.log;
server_name site2.com;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
もちろん /home/site1/www と /home/site2/www の両方にウェブサイトのファイルが含まれています。
ここで、site1.com を開こうとすると、次のような興味深い結果が得られます。
私は得ました: site1.com:81 エラーを開けません
私は何を間違っていますか?この 81 ポートが URL に追加されているのはなぜですか?