Php 根服务器始终表示欢迎使用Nginx
我正在使用并且已经在IBMSoftlayer中的Ubuntu 14.04实例上使用apt get安装了Nginx。这是我的配置,出于某种原因,我发现了奇怪的行为。我曾经使用过linux并安装过nginx,但这让人很恼火Php 根服务器始终表示欢迎使用Nginx,php,linux,ubuntu,nginx,octobercms,Php,Linux,Ubuntu,Nginx,Octobercms,我正在使用并且已经在IBMSoftlayer中的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.ph
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;
}
}
问题是,我的root显示了臭名昭著的“欢迎使用nginx!”页面,但显示了我实际的web应用程序frontpage。我曾尝试在stackoverflow中搜索类似的问题,并测试了各种响应,但都没有成功。更令人惊讶的是,当我彻底卸载nginx时,即通过执行apt get purge和delete nginx,它删除了我的web应用程序,但仍然显示令人惊讶的欢迎页面(即使在rm-rf/etc/nginx之后),所以我对这里发生的事情感到困惑。我们将不胜感激。谢谢 我认为问题与您的PHP位置块有关。尝试将位置块更新为以下配置。这是为PHP7设计的,因为Laravel不再支持PHP5
看起来您的索引没有设置为
index.php
…是我设置的。但它仍然显示出同样的错误。令人惊讶的是,两天后它开始工作。我认为这与正在进行的缓存有关。
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}