404 not found

12 views
Skip to first unread message

Massimiliano

unread,
May 2, 2017, 11:35:57 AM5/2/17
to symfony-it
Ciao allora ho risolto disabilitando nginx, ma ho risolto parzialmente,

ora mi trovo in questa situazione:

se accedo al mio sito tramite:

www.mydomain.com/app.php

riesco a far girare tutte le rotte

mentre se accedo tramite

www.mydomain.com

visualizzo solo la home page e le rotte non vanno e mi danno 404 not found, inoltre non ho nessuna traccia nei log, sia di apache che dell'applicazione, in prod.log nel folder logs di app genera il log solo nel momento in cui accedo alla home page mentre come mi sposto in un'altra rotta mi da l'errore in oggetto ma niente log.

Ho pensato potesse essere il mod_rewrite ma se da console lancio httpd -M trovo che è presente:

 rewrite_module (shared)



Il mio httpd.conf è:


ServerRoot "/etc/httpd"

Listen 80

LoadModule rewrite_module modules/mod_rewrite.so

Include conf.modules.d/*.conf

User myuser
Group psacln

ServerName www.mydomain.com:80

<Directory />
    AllowOverride none
    Require all denied
</Directory>

DocumentRoot "/var/www/vhosts/mydomain.com/httpdocs/web"

<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

<Files ".ht*">
    Require all denied
</Files>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

</IfModule>

<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule mime_module>
    TypesConfig /etc/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>


<IfModule mime_magic_module>
    MIMEMagicFile conf/magic
</IfModule>

EnableSendfile on

IncludeOptional conf.d/*.conf
GracefulShutDownTimeout 3
AddOutputFilter INCLUDES .shtml
AddType text/html .shtml
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

<VirtualHost *:80>
      
        CustomLog /var/log/httpd/mydomain.com-access.log combined
    ErrorLog /var/log/httpd/mydomain.com-error.log
        ServerName mydomain.com
    ServerAlias www.mydomain.com
        DocumentRoot /var/www/vhosts/mydomain.com/httpdocs/web
    <Directory /var/www/vhosts/mydomain.com/httpdocs/web>
                DirectoryIndex app.php
               
        AllowOverride None
                Order Allow,Deny
                Allow from All
            <IfModule mod_rewrite.c>
                  Options -MultiViews
                  RewriteEngine On
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteRule ^(.*)$ app.php [QSA,L]
            </IfModule>
#                  RedirectMatch permanent ^/app\.php/(.*) /$1
    </Directory>       
</VirtualHost>


Dove sto sbagliando?

Grazie come sempre.

Massimiliano Arione

unread,
May 2, 2017, 11:47:00 AM5/2/17
to symfony-it
Innanzitutto io sposterei la configurazione del virtualhost in un file a parte.
Poi, questa è la regola di rewrite che ho io:

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteRule ^ /app.php [L]

E comunque in debug è sempre utile abiltare il log con LogLevel alert rewrite:trace3 (o altro livello maggiore o minore di 3, vedi tu)

ciao
M.

Massimiliano

unread,
May 2, 2017, 1:01:07 PM5/2/17
to symfony-it
si lo so l'intenzione era quella di farlo funzionare prima e poi sistemare questo aspetto.

Ho apportato le modifiche che mi hai suggerito, ma non va, nell'error log ho adesso:

[Tue May 02 16:45:55.666771 2017] [rewrite:trace2] [pid 29165:tid 140058380187392] mod_rewrite.c(470): [client 132.64.127.101:54785] 132.64.127.101 - - [www.mydomain.com/sid#7f6204b70c60][rid#7f61d4006440/initial] init rewrite engine with requested uri /register/, referer: https://www.mydomain.com/
[Tue May 02 16:45:55.666829 2017] [rewrite:trace3] [pid 29165:tid 140058380187392] mod_rewrite.c(470): [client 132.64.127.101:54785] 132.64.127.101 - - [www.mydomain.com/sid#7f6204b70c60][rid#7f61d4006440/initial] applying pattern '^(.*)$' to uri '/register/', referer: https://www.mydomain.com/
[Tue May 02 16:45:55.666870 2017] [rewrite:trace4] [pid 29165:tid 140058380187392] mod_rewrite.c(470): [client 132.64.127.101:54785] 132.64.127.101 - - [www.mydomain.com/sid#7f6204b70c60][rid#7f61d4006440/initial] RewriteCond: input='www.mydomain.com' pattern='^mydomain\\.com$' [NC] => not-matched, referer: https://www.mydomain.com/
[Tue May 02 16:45:55.666886 2017] [rewrite:trace1] [pid 29165:tid 140058380187392] mod_rewrite.c(470): [client 132.64.127.101:54785] 132.64.127.101 - - [www.mydomain.com/sid#7f6204b70c60][rid#7f61d4006440/initial] pass through /register/, referer: https://www.mydomain.com/
[Tue May 02 16:45:55.670388 2017] [rewrite:trace2] [pid 29165:tid 140058380187392] mod_rewrite.c(470): [client 132.64.127.101:54785] 132.64.127.101 - - [www.mydomain.com/sid#7f6204b70c60][rid#7f61d401c1a0/initial/redir#1] init rewrite engine with requested uri /error_docs/not_found.html, referer: https://www.mydomain.com/
[Tue May 02 16:45:55.670403 2017] [rewrite:trace3] [pid 29165:tid 140058380187392] mod_rewrite.c(470): [client 132.64.127.101:54785] 132.64.127.101 - - [www.mydomain.com/sid#7f6204b70c60][rid#7f61d401c1a0/initial/redir#1] applying pattern '^(.*)$' to uri '/error_docs/not_found.html', referer: https://www.mydomain.com/
[Tue May 02 16:45:55.670410 2017] [rewrite:trace4] [pid 29165:tid 140058380187392] mod_rewrite.c(470): [client 132.64.127.101:54785] 132.64.127.101 - - [www.mydomain.com/sid#7f6204b70c60][rid#7f61d401c1a0/initial/redir#1] RewriteCond: input='www.mydomain.com' pattern='^mydomain\\.com$' [NC] => not-matched, referer: https://www.mydomain.com/
[Tue May 02 16:45:55.670414 2017] [rewrite:trace1] [pid 29165:tid 140058380187392] mod_rewrite.c(470): [client 132.64.127.101:54785] 132.64.127.101 - - [www.mydomain.com/sid#7f6204b70c60][rid#7f61d401c1a0/initial/redir#1] pass through /error_docs/not_found.html, referer: https://www.mydomain.com/

Massimiliano

unread,
May 8, 2017, 7:32:18 AM5/8/17
to symfony-it
Un aiutino? Non riesco proprio ad uscirne.

ho pensato potesse dipendere dal virtualhost 443 visto che nel trace fa riferimento ad https. Ho provato a configurare l'ssl.conf con le impostazioni suggerite anche da letsencrypt ma niente.

Non chiedo di risolvermi il problema ma anche solo da cosa potrebbe dipendere.

Grazie
Reply all
Reply to author
Forward
0 new messages