安装Laravel为Apache提供了默认主页


Install Laravel gives Apache Default Home Page

我买了一台带有Digital Ocean的服务器,并且已经尝试设置Laravel2天了。主要教程如何使用nginx网络服务器安装laravel,结果给了我一个Apache2 Ubuntu Default Page。当我转到 IP 地址时,它会给我一个Welcome to NGINX页面。我需要在接下来的几个小时内启动并运行此服务器,以便我和我的合作伙伴正在做 Pitch,但它不起作用。

有人知道修复吗?

此外,NGINX不会重新启动。它说* Restarting nginx nginx [fail],当我这样做时nginx -t它说:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

当我说sudo service nginx restart时,它会给出相同的结果

从服务器中删除 apache2 并按照@Sw0ut所说的方式启动 nginx,然后通过键入服务 nginx 启动 nginx 开始打开位于

/etc/nginx/sites-available/default

并进行适当的更改,可能的工作将是

server {
listen       80;
server_name  localhost;
root   /location/to/your/www/public/folder;
index index.php index.html index.htm;
#charset koi8-r;
#access_log  /var/log/nginx/log/host.access.log  main;
error_log  /var/log/nginx/nginx_error.log  warn;
location / {
    #try_files $uri $uri/ /index.php;
    try_files $uri $uri/ /index.php$is_args$args;
}
#error_page  404              /404.html;
#redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ '.php$ {
#    proxy_pass   http://127.0.0.1;
#}

location ~ '.php$ {
    try_files $uri =404;
    fastcgi_pass            unix:/location/to/php5-fpm.sock;
    fastcgi_index           index.php;
    include                 fastcgi_params;
    fastcgi_param           SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ '.php$ {
#    root           html;
#    fastcgi_pass   127.0.0.1:9000;
#    fastcgi_index  index.php;
#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
#    include        fastcgi_params;
#}
}

unix:/location/to/php5-fpm.sock; 在大多数情况下,php5-FPM 的位置将是/var/run/php5-fpm.sock;

还有 chmod 755/应用程序/存储文件夹,如果这不起作用,请尝试 777

如果不起作用,请重新启动nginx,停止nginx并启动它

在尝试运行nginx之前,请确保卸载所有apache2内容。

sudo apt-get remove apache2 apache2-utils
sudo service nginx start