php-实时部署时,laravel 404错误

时间:2018-10-27 10:57:05

标签: php laravel apache http-status-code-404

在实时服务器上部署项目时出现404错误。我在laravel页面上说Sorry, the page you are looking for could not be found.,所以我知道它正在到达我的项目。

我分别运行php artisan config:cachephp artisan route:cache来注册我的路线和缓存,但是它仍然没有改变。不太确定为什么会收到此错误。我在vhost中的文档根目录也设置为我的公用文件夹。

我部署的步骤

  1. 从git复制了我的项目
  2. 将分支机构更改为我的开发分支机构
  3. 授予我对项目777的权限(我只是想让它部署并查看它是否存在错误,所以我知道它是错的)
  4. 将我的虚拟主机指向project/public
  5. 添加了.env(在先前的部署中已使用它)
  6. 作曲家安装
  7. 撰写者更新
  8. php artisan config:cache
  9. php artisan route:cache

虚拟主机

<IfModule mod_ssl.c>
   <VirtualHost *:443>
      DocumentRoot /var/www/html/API/public
      #DocumentRoot /var/www/API/public/

      ServerName api.app.io
      ServerAlias api.app.io
      ErrorLog ${APACHE_LOG_DIR}/api-error.log
      CustomLog ${APACHE_LOG_DIR}/api-access.log combined

         <Directory "/var/www/API/public">
            #Options +Includes
            #Options +FollowSymLinks -Indexes
            Options All
            AllowOverride All
            Require all granted

         </Directory>

      SSLCertificateFile /etc/letsencrypt/live/api.app.io/cert.pem
      SSLCertificateKeyFile /etc/letsencrypt/live/api.app.io/privkey.pem
      Include /etc/letsencrypt/options-ssl-apache.conf
      SSLCertificateChainFile /etc/letsencrypt/live/api.app.io/chain.pem
   </VirtualHost>
</IfModule>

.htaccess

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

    RewriteEngine On

    # 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]

    # Handles JWT middleware
    RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
</IfModule>

1 个答案:

答案 0 :(得分:0)

尝试在托管面板中更改php版本。