【问题标题】:Hosting Laravel Application on Ubuntu Server在 Ubuntu 服务器上托管 Laravel 应用程序
【发布时间】:2016-11-17 11:34:32
【问题描述】:

我最近开发了我的第一个 Laravel 应用程序(5.2 版)。

我现在想在运行 Ubuntu 的客户服务器上托管应用程序。

他们的管理员设法在服务器上安装和运行本地 Laravel 应用程序,它工作得很好,但是当我复制并粘贴我自己的应用程序时,浏览器返回:

403 禁止

nginx/1.4.6 (Ubuntu)

直接访问公用文件夹(www.example.com/public/index.php)浏览器返回:

www.example.com 页面无法正常工作

www.example.com 目前无法处理此请求。

HTTP 错误 500

谁能帮我找出托管我的应用程序的正确方法吗?

【问题讨论】:

    标签: laravel ubuntu hosting


    【解决方案1】:

    看起来更像是一个 nginx 问题。尝试将您的 nginx 虚拟主机配置更改为此。

    server {
            listen   80;
            server_name yoursite.tld
    
            root /var/www/yoursite/public/;
            index index.php index.html index.htm;
    
            location / {
                 try_files $uri $uri/ /index.php$is_args$args;
            }
    
            # pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
            location ~ \.php$ {
                    try_files $uri /index.php =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;
            }
    }
    

    【讨论】:

      【解决方案2】:

      先把你的文件存进去,

      var/www/html/

      然后使用终端转到您的文件夹
      cd var/www/html/your_folder

      运行 Laravel 应用程序

      sudo php -S localhost:8888 -t public
      

      确保您的端口号与服务器中运行的其他 Laravel 实例不同。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-11-20
        • 1970-01-01
        • 2021-03-05
        • 1970-01-01
        • 2019-01-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多