Laravel部署配置

时间:2019-02-06 14:23:14

标签: php laravel .htaccess virtualhost

在我的httpd.conf文件中,我有:

DocumentRoot /var/www/my-domain.com/public
ServerName my-domain.ir
<Directory /var/www/my-domain.com/public>
DirectoryIndex index.php
Options All
AllowOverride All
Require all granted
</Directory>

在我的laravel_project_root/public目录中,我有一个.htaccess文件,该文件具有:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    Options +FollowSymLinks

    RewriteEngine On

    # Force http to https
    #RewriteCond %{HTTPS} off
    #RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

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

结果是:

服务不可用

由于维护停机或容量问题,服务器暂时无法满足您的请求。请稍后再试。

当我使用index.html文件并将其DirectoryIndex index.php更改为DirectoryIndex index.html时,它将起作用!但是我不知道在这些配置中我的错误是php文件无法加载。

任何建议将不胜感激。

更新 error_log

[Wed Feb 06 09:42:15.751947 2019] [suexec:notice] [pid 50730] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Feb 06 09:42:15.812330 2019] [auth_digest:notice] [pid 50730] AH01757: generating secret for digest authentication ...
[Wed Feb 06 09:42:15.813030 2019] [lbmethod_heartbeat:notice] [pid 50730] AH02282: No slotmem from mod_heartmonitor
[Wed Feb 06 09:42:16.000310 2019] [mpm_prefork:notice] [pid 50730] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 PHP/7.2.14 configured -- resuming normal operations
[Wed Feb 06 09:42:16.000381 2019] [core:notice] [pid 50730] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Wed Feb 06 09:42:21.644207 2019] [proxy:error] [pid 50732] (111)Connection refused: AH00957: FCGI: attempt to connect to 127.0.0.1:9000 (*) failed
[Wed Feb 06 09:42:21.644312 2019] [proxy_fcgi:error] [pid 50732] [client 2.176.232.178:61732] AH01079: failed to make connection to backend: 127.0.0.1
[Wed Feb 06 09:42:22.552480 2019] [proxy:error] [pid 50734] (111)Connection refused: AH00957: FCGI: attempt to connect to 127.0.0.1:9000 (*) failed
[Wed Feb 06 09:42:22.552599 2019] [proxy_fcgi:error] [pid 50734] [client 2.176.232.178:61733] AH01079: failed to make connection to backend: 127.0.0.1
[Wed Feb 06 09:42:23.256763 2019] [proxy:error] [pid 50735] (111)Connection refused: AH00957: FCGI: attempt to connect to 127.0.0.1:9000 (*) failed
[Wed Feb 06 09:42:23.256860 2019] [proxy_fcgi:error] [pid 50735] [client 2.176.232.178:61734] AH01079: failed to make connection to backend: 127.0.0.1

0 个答案:

没有答案