我为此绞尽了脑汁。我拥有的每个网站都会重定向回我的其他网站之一...我会说那是 /default 网站,但直到我将其设为默认网站后才发现并非如此,这并没有改变任何东西。所有网址都让我回到 www.justaleaf.com
(转换前所有网站均正常运行,当我禁用所有其他网站时,myhashimotos 网站由于重定向登陆而能够正常运行)
以下是我的配置(带有 mysql php-fpm 的 ubuntu)...我是 nginx 新手,现在很迷茫:
/etc/nginx/nginx.conf
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
multi_accept on;
use epoll;
}
http {
##
# Basic Settings
##
sendfile on;
#tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
目录内容
justaleaf@webserver /etc/nginx/sites-available
$ ls -a
. default www.harmonicult.com .www.justaleaf.com.swp
.. default.dpkg-old www.justaleaf.com www.myhashimotosthyroiditis.com
justaleaf@webserver /etc/nginx/sites-available
$ ls -a ../sites-enabled
. www.justaleaf.com www.myhashimotosthyroiditis.com
.. www.harmonicult.com
以下是我的网站配置文件:
/www.myhashimotosthyroiditis.com
注意:为了进行测试,只需尝试访问 myhashimotosthyroiditis.com,那里的重定向很明显。
答案1
harmonicult 中的第二台服务器中有一个 /;第 12 行http://pastie.org/3801824 很确定 server_name 中不允许这样做。
(试图将其作为评论,但我需要代表,所以好吧。希望这会有所帮助。)