samedi 2 juin 2018

Deploying Laravel on openSUSE: api routes not working

I Deployed a Laravel web application on a Tumbleweed openSUSE. I can access all routes defined in routes/web.php, but all routes in routes/api.php returned 404 not found.

Here's my apache2 httpd.conf file:

Include /etc/apache2/uid.conf
Include /etc/apache2/server-tuning.conf

<IfDefine !SYSCONFIG>
  Include /etc/apache2/loadmodule.conf
</IfDefine>

<IfDefine !SYSCONFIG>
  Include /etc/apache2/global.conf
</IfDefine>

Include /etc/apache2/mod_status.conf
Include /etc/apache2/mod_info.conf

Include /etc/apache2/mod_reqtimeout.conf

Include /etc/apache2/mod_cgid-timeout.conf

Include /etc/apache2/mod_usertrack.conf

Include /etc/apache2/mod_autoindex-defaults.conf

TypesConfig /etc/apache2/mime.types
Include /etc/apache2/mod_mime-defaults.conf

Include /etc/apache2/errors.conf

Include /etc/apache2/ssl-global.conf


# forbid access to the entire filesystem by default
<Directory />
    Options None
    AllowOverride All
    <IfModule !mod_access_compat.c>
        Require all denied
    </IfModule>
    <IfModule mod_access_compat.c>
        Order deny,allow
        allow from all
    </IfModule>
</Directory>

<Directory "/srv/www">
    AllowOverride All
</Directory>



AccessFileName .htaccess

<Files ~ "^\.ht">
    <IfModule !mod_access_compat.c>
        Require all denied
    </IfModule>
    <IfModule mod_access_compat.c>
        Order allow,deny
        allow from all
    </IfModule>
</Files>

DirectoryIndex index.html index.html.var

Include /etc/apache2/default-server.conf

and this is my .htaccess file I put inside the htdocs folder

<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]
</IfModule>

I hope someone can help me on this. I'm pretty new to linux especially openSUSE. Also, I'm sorry for my bad English.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire