【问题标题】:Laravel Production serverLaravel 生产服务器
【发布时间】:2015-02-26 03:07:21
【问题描述】:

尝试将我的 laravel 应用程序放在生产服务器上时出现错误。我在我的服务器上启用了 mod_rewrite 并更改了应用程序/存储的权限

“异常处理程序中的错误”

这是我的 .htaccess 文件

   <IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On

    RewriteBase /escrow/

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
  </IfModule>

这是我的虚拟主机文件:

   <VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/laravel/public/
    <Directory />
            Options FollowSymLinks
            AllowOverride all
    </Directory>
    <Directory /var/www/laravel/public>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride all
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

【问题讨论】:

    标签: php apache .htaccess mod-rewrite laravel


    【解决方案1】:

    也许在你的 apache.conf 中。这在我的 apache.conf 中工作

    <Directory /var/www/laravel/public>
            Options -Indexes +FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>

    【讨论】:

    • 我得到的是“内部服务器错误服务器遇到内部错误或配置错误,无法完成您的请求。”
    • 嗯,很奇怪..你重启你的apache服务了吗?
    【解决方案2】:

    试试这个

    <IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews
        </IfModule>
    
        RewriteEngine On
    
        # Redirect Trailing Slashes...
        RewriteRule ^(.*)/$ /$1 [L,R=301]
    
        # Handle Front Controller...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
    </IfModule>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-23
      • 1970-01-01
      • 2019-01-27
      • 2017-01-17
      • 2016-04-30
      • 2020-08-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多