我正在使用OctoberCMS,并在 IBM Softlayer 的 Ubuntu 14.04 实例上使用 apt-get 安装了 Nginx。这是我的配置,出于某种原因,我发现了奇怪的行为。我曾经使用过 linux 并且之前安装过 nginx,但这很烦人。
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html/hd;
index index.php index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
rewrite ^themes/.*/(layouts|pages|partials)/.*.htm /index.php break;
rewrite ^bootstrap/.* /index.php break;
rewrite ^config/.* /index.php break;
rewrite ^vendor/.* /index.php break;
rewrite ^storage/cms/.* /index.php break;
rewrite ^storage/logs/.* /index.php break;
rewrite ^storage/framework/.* /index.php break;
rewrite ^storage/temp/protected/.* /index.php break;
rewrite ^storage/app/uploads/protected/.* /index.php break;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
问题是我的根http://mywebsite.com/显示臭名昭著的“欢迎使用 nginx!” 页面,但http://mywebsite.com/index.php显示了我实际的 Web 应用程序首页。我曾尝试在 stackoverflow 中搜索类似问题并测试了各种响应,但徒劳无功。更令人惊讶的是,当我彻底卸载 nginx 时,即通过执行 apt-get purge 并删除 nginx,它删除了我的网络应用程序,但仍然显示欢迎页面,这令人惊讶(即使在 rm -rf /etc/nginx 之后)所以我对这里发生的事情感到困惑。帮助将不胜感激。谢谢!