【问题标题】:Creating your first laravel project on web server在 Web 服务器上创建你的第一个 laravel 项目
【发布时间】:2015-10-31 11:03:28
【问题描述】:

我最近刚刚按照本指南在我的 Lamp 服务器上“安装”了 laravel:https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04

现在当我完成时,它会在他们的指南底部显示

“你现在已经完全安装好 Laravel 并准备好了。你可以 通过访问您的服务器的域或 IP 查看默认登录页面 您的网络浏览器中的地址:

http://server_domain_or_IP"

当我访问我的网站时,没有新的登录页面,并且 var/www/html 中没有新文件可以作为登录页面,除了标准的 apache 文件。

对我来说这很好,但我仍然不知道如何创建我的第一个项目,我想这样做以检查我的安装是否完成并且我准备好睡觉了。

这是我的 www 目录目前的样子:

这是我的 nginx 配置,我相信它在整个过程中发挥了作用:

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;
    root /var/www/laravel/public;
    index index.php index.html index.htm;

    server_name www.mysite.me;

    location / {
            try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
    try_files $uri /index.php =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

}

【问题讨论】:

    标签: php laravel nginx server


    【解决方案1】:

    文件位于 /var/www/laravel 文件夹中,而不是您提供的屏幕截图中可见的 /var/www/html 文件夹中。

    根据我自己的经验,这是由于在不同网站的多个 nginx 配置文件中具有多个“默认服务器”属性,因此当通过 IP 查看服务器时,它不会选择新的 laravel 构建。

    【讨论】:

    • 我最近还注意到,现在我的网站可以正常工作并显示 laravel 登录页面,但现在我无法访问位于 www/html 的网站的其他部分。有什么办法可以解决这个问题?
    • 或者我可以预先将我仍然想要的网站移动到 laravel 文件夹中的公共网站吗?我将如何处理这个?
    • 将html网站移动到公用文件夹很可能会导致问题,如果您只是通过IP访问您的网站,您可以监听多个端口httpd.apache.org/docs/2.2/vhosts/examples.html#port
    【解决方案2】:

    服务器需要重新启动才能进行某些设置。

    你可以尝试访问它的控制台并输入

    要从命令行重新启动服务器,请运行:

    sudo shutdown -r now
    

    要重新启动 Apache,请运行:

     sudo service apache2 restart
    

    【讨论】:

      猜你喜欢
      • 2014-03-31
      • 2011-06-25
      • 2015-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多