我只是尝试第一次部署Symfony(3.3.5)项目,而且我遇到了一些麻烦。
MySQL被安装并运行在服务器上,Symfony可以连接到它。 Apache2和PHP也在运行。 (和简单的PHP文件像echo "hello world"按预期工作)。
我有两点:
首先:当我尝试访问http://example.com/web/app.php时,出现错误代码为500的“网页无法正常工作”(这是Chrome的错误消息)。对于任何其他URL(例如http: //example.com/web/app.php/login 。
第二:为什么我仍然必须使用/web/app.php路由(如果我不使用它,服务器显示我的Web服务器的目录资源pipe理器),而我的.htaccess文件如下所示:
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ web/$1 [QSA,L] </IfModule>
而我的/etc/apache2/sites-available/example.com.conf文件是:
<VirtualHost *:80> ServerAdmin [email protected] ServerName example.com ServerAlias dev.gepacte.com DocumentRoot /var/www/example.com/public_html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined <Directory "/var/www/example.com/public_html"> <IfModule sapi_apache2.c> php_admin_flag engine on </IfModule> <IfModule mod_php5.c> php_admin_flag engine on </IfModule> #If one of the following lines is uncommented, the apache2 serve won't restart. #DirectoryIndex app.php #Options -Indexes #AllowOverride All #Allow from All </Directory> </VirtualHost>
当然,我的symfony项目位于/var/www/example.com/public_html
编辑:
我的/var/log/apache2/access.log文件:
80.215.95.207 - - [07/Nov/2017:18:22:44 +0100] "GET /web/app.php/ HTTP/1.1" 500 716 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"
和/var/log/apache2/error.log文件:
[Tue Nov 07 18:24:20.542808 2017] [mpm_prefork:notice] [pid 17564] AH00169: caught SIGTERM, shutting down [Tue Nov 07 18:24:20.723226 2017] [mpm_prefork:notice] [pid 22562] AH00163: Apache/2.4.25 (Debian) configured -- resuming normal operations [Tue Nov 07 18:24:20.723301 2017] [core:notice] [pid 22562] AH00094: Command line: '/usr/sbin/apache2'