
我遇到麻煩了為我的 Droplet 上的目錄設定子網域(數位海洋):
我有我的 Droplet 的網域 Primarydomain.com...我建立了一個目錄 /livezilla/
例子:
Primarydomain.com/livezilla
我想在此目錄中新增外部子網域(利維茲拉):
chat.myotherdomain.com.br
我在:/etc/nginx/sites-avaliable/primarydomain.com:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
server_name primarydomain.com;
location / {
try_files $uri $uri/ /index.php?q=$uri&args;
}
}
和
/etc/nginx/sites-avaliable/chat.myotherdomain.com.br
server {
listen 80;
listen [::]:80;
server_name chat.myotherdomain.com.br;
root /usr/share/nginx/html/livezilla/;
index index.php index.html index.htm;
}
(在 /etc/nginx/sites-enabled 上有一個副本)
這chat.myotherdomain.com.br 有 A 記錄在指向我的 Droplet 的 DNS 中..
chat.myotherdomain.com.br 現在重定向到 myotherdomain.com.br 但透過 ping 顯示我的 Droplet ip。 )):
怎麼了?
答案1
這解決了我的問題。 Wtf。
server {
listen chat.myotherdomain.com.br:80;
server_name chat.myotherdomain.com.br;
root /usr/share/nginx/html/livezilla;
index index.php index.html index.htm;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
}