John Davidson

php - Deploy Symfony API on Apache - routes not found

0 comments
Message:


I tried to deploy a Symfony API with apache on port 8000. I can access the index.php (Symfony default page), but when I tried a route like http://{{ my_ip_adress }}:8000/api/users, I have a 404 error.


Apache file.conf


Listen 8000
<VirtualHost *:{{ http_port }}>
DocumentRoot /var/www/{{ http_host }}
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /var/www/{{ http_host }}>
Options Indexes FollowSymLinks
AllowOverride All
Allow from All
</Directory>

<IfModule mod_dir.c>
DirectoryIndex ./app/public/index.php
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase ./

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ./app/public/index.php

</IfModule>
</VirtualHost>

It's my first deployment, so I don't understand how Apache works yet.



My Answer:

ServerName example.com
DocumentRoot /path/to/symfony/public

AllowOverride All
Order Allow,Deny
Allow from All
FallbackResource /index.php

Rate this post

3 of 5 based on 7469 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us