Bonjour à tous,
Ayant souscris à un vps chez Ovh, j'aimerais que mon fichier "index.php" se trouvant dans un autre répertoire pointe à la racine de mon domaine.
> root@vps:/var/www/domain.com/public_html# pwd
> /var/www/domain.com/public_html
> root@vps:/var/www/domain.com/public_html# ls -l
> total 8
> lrwxrwxrwx 1 root root 21 juil. 12 21:18 index.php -> serendipity/index.php
> drwxr-xr-x 14 www-data www-data 4096 juil. 12 12:28 serendipity
> drwxrwxrwx 23 root root 4096 juil. 9 20:53 tt-rss
Vous l'aurez compris, index.php étant un lien symbolique pointant vers
> /var/www/domain.com/public_html/serendipity/index.php
J'ai configuré Apache pour faire en sorte d'autoriser les liens symboliques dans ce répertoire.
> nano /etc/apache2/apache2.conf
>
> DirectoryIndex index.php
> Options +Indexes +FollowSymLinks
> AllowOverride None
> Require all granted
>
Or, quand je vais sur mondomain.net, je suis redirigé vers
> www.mondomain.com//serendipity_admin.php
Je ne comprends pas d'où pourrais venir le problème…
Merci d'avance.
Tu devrais passer par la configuration du vhost et du Documentroot plutôt que via des liens symboliques
Voici la config de mon vhost:
>
> ServerAdmin contact@domain.com
> ServerName domain.com
> ServerAlias www.domain.com
> DocumentRoot /var/www/domain.com/public_html/serendipity
> ErrorLog ${APACHE_LOG_DIR}/error.log
> CustomLog ${APACHE_LOG_DIR}/access.log combined
> RewriteEngine on
> RewriteCond %{SERVER_NAME} =domain.com [OR]
> RewriteCond %{SERVER_NAME} =www.domain.com
> RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
> domain.com/public_html/serendipity/>
> DirectoryIndex index.php
> Options FollowSymLinks MultiViews
> AllowOverride All
> Order allow,deny
> allow from all
>
>
En guise de remerciement j'ai droit à un:
> Forbidden
> You don't have permission to access / on this server.
Concernant le log Apache:
> Cannot serve directory /var/www/domain.com/public_html/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
Je ne comprends pas sachant que j'ai bien ajouté:
> DirectoryIndex index.php
Merci
/var/www/domain.com/public_html/serendipity
Ce dossier existe bien ?
(il manque peut être un / à la fin..)
Il y a bien un index.php dans ce dossier ?
Avez vous redémarrer apache après la modification du vhost ?
Merci pour t'on aide.
Oui le dossier existe bien, le chemin exact:
> /var/www/domain.com/public_html/serendipity
Concernant le contenu:
> root@vps:/var/www/domain.com/public_html/serendipity# ls -l
> total 2012
> drwxr-xr-x 2 www-data www-data 4096 avril 9 09:35 archives
> drwxr-xr-x 17 www-data www-data 4096 avril 9 09:35 bundled-libs
> -rwxr-xr-x 1 www-data www-data 257288 avril 9 09:36 checksums.inc.php
> -rwxr-xr-x 1 www-data www-data 9654 avril 9 09:35 comment.php
> -rwxr-xr-x 1 www-data www-data 327 avril 9 09:35 composer.json
> -rwxr-xr-x 1 www-data www-data 1640227 avril 9 09:35 composer.phar
> drwxr-xr-x 5 www-data www-data 4096 avril 9 09:35 deployment
> drwxr-xr-x 2 www-data www-data 4096 avril 9 09:35 docs
> -rwxr-xr-x 1 www-data www-data 1512 avril 9 09:35 exit.php
> drwxr-xr-x 4 www-data www-data 4096 avril 9 09:35 htmlarea
> drwxr-xr-x 5 www-data www-data 4096 avril 9 09:35 include
> -rwxr-xr-x 1 www-data www-data 4653 avril 9 09:35 index.php
> drwxr-xr-x 3 www-data www-data 4096 avril 9 09:35 lang
> drwxr-xr-x 32 www-data www-data 4096 avril 9 09:35 plugins
> -rwxr-xr-x 1 www-data www-data 323 avril 9 09:35 README.markdown
> -rwxr-xr-x 1 www-data www-data 12067 avril 9 09:35 rss.php
> -rwxr-xr-x 1 www-data www-data 12513 avril 9 09:35 serendipity_admin_image_selector.php
> -rwxr-xr-x 1 www-data www-data 8948 avril 9 09:35 serendipity_admin.php
> -rwxr-xr-x 1 www-data www-data 18646 avril 9 09:35 serendipity_config.inc.php
> -rwx------ 1 www-data www-data 657 juil. 13 10:36 serendipity_config_local.inc.php
> -rwxr-xr-x 1 www-data www-data 4030 avril 9 09:35 serendipity.css.php
> -rwxr-xr-x 1 www-data www-data 376 avril 9 09:35 serendipity_xmlrpc.php
> drwxr-xr-x 2 www-data www-data 4096 avril 9 09:35 sql
> drwxr-xr-x 14 www-data www-data 4096 juil. 12 12:19 templates
> drwxr-xr-x 14 www-data www-data 4096 juil. 13 10:31 templates_c
> drwxr-xr-x 2 www-data www-data 4096 avril 9 09:35 uploads
> -rwxr-xr-x 1 www-data www-data 1404 avril 9 09:35 wfwcomment.php
À chaque changement de configuration je relance Apache.
> service apache2 reload
Et si tu ajoutés le / à la fin du chemin du dossier ?
Tu as modifié juste 000-default.conf ou généré un Vhost pour ce ndd ? + a2esnsite a été fait ? + au niveau du propriétaire/groupe de index.php = tu as quoi ? (ls -lh)
> Et si tu ajoutés le / à la fin du chemin du dossier ?
Toujours la même erreur
> Tu as modifié juste 000-default.conf ou généré un Vhost pour ce ndd ?
Je l'ai généré et nommé domain.com.conf
> a2esnsite a été fait
Oui
> au niveau du propriétaire/groupe de index.php = tu as quoi ? (ls -lh)
drwxr-xr-x 2 www-data www-data 4,0K avril 9 09:35 archives
drwxr-xr-x 17 www-data www-data 4,0K avril 9 09:35 bundled-libs
-rwxr-xr-x 1 www-data www-data 252K avril 9 09:36 checksums.inc.php
-rwxr-xr-x 1 www-data www-data 9,5K avril 9 09:35 comment.php
-rwxr-xr-x 1 www-data www-data 327 avril 9 09:35 composer.json
-rwxr-xr-x 1 www-data www-data 1,6M avril 9 09:35 composer.phar
drwxr-xr-x 5 www-data www-data 4,0K avril 9 09:35 deployment
drwxr-xr-x 2 www-data www-data 4,0K avril 9 09:35 docs
-rwxr-xr-x 1 www-data www-data 1,5K avril 9 09:35 exit.php
drwxr-xr-x 4 www-data www-data 4,0K avril 9 09:35 htmlarea
drwxr-xr-x 5 www-data www-data 4,0K avril 9 09:35 include
-rwxr-xr-x 1 www-data www-data 4,6K avril 9 09:35 index.php
drwxr-xr-x 3 www-data www-data 4,0K avril 9 09:35 lang
drwxr-xr-x 32 www-data www-data 4,0K avril 9 09:35 plugins
-rwxr-xr-x 1 www-data www-data 323 avril 9 09:35 README.markdown
-rwxr-xr-x 1 www-data www-data 12K avril 9 09:35 rss.php
-rwxr-xr-x 1 www-data www-data 13K avril 9 09:35 serendipity_admin_image_selector.php
-rwxr-xr-x 1 www-data www-data 8,8K avril 9 09:35 serendipity_admin.php
-rwxr-xr-x 1 www-data www-data 19K avril 9 09:35 serendipity_config.inc.php
-rwx------ 1 www-data www-data 657 juil. 13 10:36 serendipity_config_local.inc.php
-rwxr-xr-x 1 www-data www-data 4,0K avril 9 09:35 serendipity.css.php
-rwxr-xr-x 1 www-data www-data 376 avril 9 09:35 serendipity_xmlrpc.php
drwxr-xr-x 2 www-data www-data 4,0K avril 9 09:35 sql
drwxr-xr-x 14 www-data www-data 4,0K juil. 12 12:19 templates
drwxr-xr-x 14 www-data www-data 4,0K juil. 13 10:31 templates_c
drwxr-xr-x 2 www-data www-data 4,0K avril 9 09:35 uploads
-rwxr-xr-x 1 www-data www-data 1,4K avril 9 09:35 wfwcomment.php
Et dans le log erreur quel est le message exact ?
> [autoindex:error] [pid 4516] [client ...:*****] AH01276: Cannot serve directory /var/www/domain.com/public_html/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
Remplace ton index.php par une page basique en html + appelle le index.htmt pour voir
Il n'y a pas un problème de majuscule ou minuscule ou coquille dans le path du dossier?
Bonjour,
Votre vhost ne correspond pas avec le message d'erreur.
Que donne un ls -alh sur /etc/apache2/sites-enabled/ ?
Cordialement, janus57
Merci à vous tous pour votre aide, je suis au boulot et je n'ai pas d'accès à SSH. Je vous tiens au courant en soirée, merci.
> Remplace ton index.php par une page basique en html + appelle le index.htmt pour voir
Toujours la même erreur.
> Il n'y a pas un problème de majuscule ou minuscule ou coquille dans le path du dossier?
Non j'ai vérifié plusieurs fois et fait un copier/coller du chemin pour être sur.
> Bonjour,
> Votre vhost ne correspond pas avec le message d'erreur.
> Que donne un ls -alh sur /etc/apache2/sites-enable/ ?
> Cordialement, janus57
Peut-être une piste…
> ls: cannot access /etc/apache2/sites-enable/: No such file or directory
Bonjour,
bon déjà les question de base :
* quel OS ?
* que contient exactement votre VHost ?
Cordialement, janus57
> quel OS ?
Ubuntu 14.04 64 Bits
> que contient exactement votre VHost ?
Voici le contenu :
>
> ServerAdmin contact@domain.com
> ServerName domain.com
> ServerAlias www.domain.com
> DocumentRoot /var/www/domain.com/public_html/serendipity/
> ErrorLog ${APACHE_LOG_DIR}/error.log
> CustomLog ${APACHE_LOG_DIR}/access.log combined
> RewriteEngine on
> RewriteCond %{SERVER_NAME} =domain.com [OR]
> RewriteCond %{SERVER_NAME} =www.domain.com
> RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
> domain.com/public_html/serendipity/>
> DirectoryIndex index.php
> Options FollowSymLinks MultiViews
> AllowOverride All
> Order allow,deny
> allow from all
>
>
Bonjour,
que donne donc :
`ls -alh sur /etc/apache2/sites-enabled/`
Note : avec le vrai domaine ce serait quand même mieux…
Cordialement, janus57
> que donne donc :
> ls -alh sur /etc/apache2/sites-enabled/
ls -alh /etc/apache2/sites-enabled/
total 8,0K
drwxr-xr-x 2 root root 4,0K juil. 13 22:12 .
drwxr-xr-x 8 root root 4,0K juil. 9 16:48 ..
lrwxrwxrwx 1 root root 34 juil. 12 23:37 cbruno.net.conf -> ../sites-available/cbruno.net.conf
lrwxrwxrwx 1 root root 51 juil. 9 16:34 cbruno.net-le-ssl.conf -> /etc/apache2/sites-available/cbruno.net-le-ssl.conf
lrwxrwxrwx 1 root root 40 juil. 12 01:25 ttrss.cbruno.net.conf -> ../sites-available/ttrss.cbruno.net.conf
> Note : avec le vrai domaine ce serait quand même mieux…
C'est noté
.
Bonjour,
apache à bien été restart après l'activation des VHost ?
Note : d'ailleurs il manque des bouts du vhost là comme un petit
Cordialement, janus57