【发布时间】:2013-12-20 12:52:13
【问题描述】:
我仍在为我的网络服务器中的 make rewrite 规则而苦苦挣扎。当我尝试登录(www.example.com/admin/)到我的后端时,我只有白页。但是如果我尝试添加 index (www.example.com/admin/index) 或 index.php (www.example.com/admin/index.php) 我的后端正在工作。那么如何编辑函数 www.example.com/admin/ 的代码?
非常感谢您的帮助!
这是我的代码:
server_names_hash_bucket_size 64;
server {
listen 80;
server_name example.com;
return 301 $scheme://www.example.com$request_uri;
}
server {
listen 80;
root /usr/share/nginx/www;
index index.php;
server_name www.example.com;
location /admin/ {
rewrite ^ /admin/index.php;
}
location / {
rewrite ^([^\.]*)$ /$1.php;
}
location = / {
rewrite ^ /index.php;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
【问题讨论】:
-
这是我的错误 [emerg] unexpected "}" in /etc/nginx/sites-enabled/default:18 nginx: configuration file /etc/nginx/nginx.conf test failed