【问题标题】:Moved Laravel project from Apache to Nginx将 Laravel 项目从 Apache 迁移到 Nginx
【发布时间】:2016-12-26 16:39:31
【问题描述】:

我已经在 centos 服务器上部署了我的 laravel 应用程序,我必须在 httpd.conf 中添加下面提到的行以使其工作

<Directory "/var/www/html/ezschedular2/public">
  Allowoverride All
</Directory>

我们决定现在使用nginx,这些行的替代品是什么?我必须在文件夹/etc/nginx/conf.d 中的default.conf 上添加这些行的替代项

【问题讨论】:

    标签: apache nginx centos laravel-5.2


    【解决方案1】:

    这是我为 Laravel 配置的 nginx。更改变量以满足您的需要

    server {
        listen 80;
        server_name YOURSERVERNAME_OR_IP;
        root YOUR_PATH_TO_LARAVEL_PUBLIC_FOLDER;
    
        index index.html index.htm index.php;
    
        charset utf-8;
    
        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }
    
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2014-05-28
      • 2014-06-04
      • 2017-02-10
      • 2019-07-21
      • 2016-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-14
      相关资源
      最近更新 更多