我有一个服务器与Nginx下运行良好(WordPress博客)的服务器域。 现在我想设置一个phplist服务器,并find它在一个子域下,但虽然我认为我configuration了子域没有问题,每次我尝试加载子域请求直接到我的域之一。
这是我的域的Nginxconfiguration文件(我已经replace了域名):
server { listen 80; server_name mydomain.com www.mydomain.com; # error_log /var/www/mydomain/mydomain_error.log; root /var/www/mydomain/; location ~* ^.+.(bz2|jpe?g|gif|gz|png|ico|css|zip|rar|doc|xls|exe|pdf|ppt|txt|tar|tgz|mid|midi|mp3|wav|bmp|rtf\ |js|swf|avi|m2t|mkv)$ { access_log off; expires 30d; root /var/www/mydomain/; } location / { index index.php; client_max_body_size 3M; try_files $uri $uri/ /index.php?q=$uri&$args; # if the requested file exists, return it immediately if (-f $request_filename) { break; } #if ($http_user_agent !~ FeedBurner) { # rewrite ^/comment/feed/ http://feeds.feedburner.com/your-comment-feed last; # rewrite ^/feed/ http://feeds.feedburner.com/Muypymes last; # } if ($http_user_agent !~ "^MediafedMetrics.*") { rewrite ^/feed/?$ http://feeds.feedburner.com/Muypymes last; } # all other requests go to WordPress if (!-e $request_filename) { rewrite . /index.php last; } } ## Parse all .php file in the /var/www directory location ~ .php$ { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass backend; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/mydomain/$fastcgi_script_name; include fastcgi_params; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_intercept_errors on; fastcgi_ignore_client_abort on; fastcgi_read_timeout 360; } ## Disable viewing .htaccess & .htpassword location ~ /\.ht { deny all; } location = /favicon.ico { access_log off; log_not_found off; } } upstream backend { server 127.0.0.1:9000; }
这是在Nginx的Wiki之后configuration的子域的configuration文件。 正如你所看到的,子域来自不同的域,而不是它redirect到的域。
我的意思是,当我去phplist.myotherdomain.com,它去www.mydomain.com。 Myotherdomain和Mydomain是不同的,事实上,主要的myotherdomain是在其他服务器,工作sepparately(我想保持这样)。 这是configuration文件:
server { listen 80; server_name phplist.myotherdomain.com; root /var/www/phplist/public_html/lists; index index.php; #access_log <<log file>>; #error_log <<log file>>; charset utf-8; location ~* \.(txt|log|inc)$ { allow 127.0.0.1; deny all; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } #block phplist config directory location /config { deny all; } #per the phplist .htaccess these are the only public allowed php files location ~* (index\.php|upload\.php|connector\.php|dl\.php|ut\.php|lt\.php|download\.php)$ { fastcgi_split_path_info ^(.|\.php)(/.+)$; include /etc/nginx/fastcgi_params.conf; #standar fastcgi config file fastcgi_param SCRIPT_FILENAME /var/www/phplist/public_html/lists$fastcgi_script_name; fastcgi_intercept_errors on; fastcgi_pass 127.0.0.1:9000; } #block all other php file access from public location ~ \.php$ { deny all; } }
我认为问题在于fastcgi部分,但我不确定那里有什么问题。 我正和Nginx一起使用PHP-FPM。 根文件夹是好的,我的博客和phplist服务器的文件应该是。
有任何想法吗?