我有以下 nginx 配置片段:
server {
listen 80;
server_name mydomain.io;
root /srv/www/domains/mydomain.io;
index index.html index.php;
access_log /var/log/nginx/domains/mydomain.io/access.log;
error_log /var/log/nginx/domains/mydomain.io/error.log;
location ~\.php {
try_files $uri =404;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
}
}
首先,我怎样才能让服务器块响应both
http://www.mydomain.io和http://mydomain.io。其次,如果他们来自http://www.mydomain.io ,我想强制重定向到http://mydomain.io。
谢谢。