使用/nginx 设置子域的问题
Issues settings up subdomains w/ nginx
我正在尝试为我的 PhpMyAdmin 网站设置一个子域,但我在尝试让它工作时遇到了问题。当我访问我的网站时,一切都按预期工作,但是当我访问我已设置的子域时,它显示的是常规网站,与 PhpMyAdmin 无关。我一直在尝试几种不同的组合来尝试使它正常工作,但我无法弄清楚。这是我第一次尝试使用 nginx,所以我需要一些帮助。这是我的以下配置文件。
/etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
/etc/nginx/conf.d/default.conf
server {
listen 80;
server_name www.cozykittygames.com;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
server {
server_name pma.cozykittgames.com;
root /usr/share/phpmyadmin;
}
我已经尝试了所有我能想到的方法,我的子域被设置为与常规域完全相同的副本,只是 server_name 不同。在这一点上,如果我能让子域指向正确的文件夹就太好了。
问题是您的服务器名称中有错字,遗漏了 "kitty" 中的 "y"。应该是:
server_name pma.cozykittygames.com;
我正在尝试为我的 PhpMyAdmin 网站设置一个子域,但我在尝试让它工作时遇到了问题。当我访问我的网站时,一切都按预期工作,但是当我访问我已设置的子域时,它显示的是常规网站,与 PhpMyAdmin 无关。我一直在尝试几种不同的组合来尝试使它正常工作,但我无法弄清楚。这是我第一次尝试使用 nginx,所以我需要一些帮助。这是我的以下配置文件。
/etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
/etc/nginx/conf.d/default.conf
server {
listen 80;
server_name www.cozykittygames.com;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
server {
server_name pma.cozykittgames.com;
root /usr/share/phpmyadmin;
}
我已经尝试了所有我能想到的方法,我的子域被设置为与常规域完全相同的副本,只是 server_name 不同。在这一点上,如果我能让子域指向正确的文件夹就太好了。
问题是您的服务器名称中有错字,遗漏了 "kitty" 中的 "y"。应该是:
server_name pma.cozykittygames.com;