安装Laravel提供Apache默认主页

时间:2014-11-15 12:11:12

标签: php apache ubuntu laravel nginx

我买了一台Digital Ocean服务器,现在已经尝试将Laravel设置为2天了。主要教程How to install laravel with an nginx web server和结果给了我一个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

时,它会得到相同的结果

2 个答案:

答案 0 :(得分:0)

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

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

答案 1 :(得分:0)

从服务器中删除apache2并启动nginx,因为@ Sw0ut表示然后通过输入service nginx start nginx启动打开位于

的nginx.conf文件
/etc/nginx/sites-available/default

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

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 / app / storage文件夹如果不起作用,请尝试777

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