我正在尝试在 NGINX 中配置一个子域。我哪里错了?
以下是配置文件:
server {
listen 80;
server_name www.teamomattic.com;
rewrite ^/(.*) http://teamomattic.com permanent;
}
server {
listen 80 default;
server_name teamomattic.com *.teamomattic.com;
root /home/jclark/web/teamomattic.com;
access_log /var/log/nginx/$host-access.log;
error_log /var/log/nginx/dev-error.log error;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php/$1;
}
location ~ \.php {
# try_files $uri =404;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
server {
listen 80;
server_name test.teamomattic.com;
root /home/jclark/web/teamomattic.com/images;
access_log /var/log/nginx/$host-access.log;
error_log /var/log/nginx/dev-error.log error;
index index.php index.html index.htm;
}
Run Code Online (Sandbox Code Playgroud)
只是猜测。我会这样做。
server
{
listen 80;
server_name subdomain.teamomattic.com;
location / { return 303 http://teamomattic.com$request_uri; }
}
Run Code Online (Sandbox Code Playgroud)
request_uri传递路径和查询字符串 - 这样您就不会丢失该信息。| 归档时间: |
|
| 查看次数: |
602 次 |
| 最近记录: |