Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 25/10/2016, à 22:08

bmzoom

[Résolu : VirtualHost]Permission non accordée - Ubuntu 16.04

bonjour,

You don't have permission to access / on this server.
Apache/2.4.18 (Ubuntu) Server at hellobtc.btc Port 80
---------------------------------------------------------------------

Ma méthode :
sudo gedit /etc/apache2/sites-available/hellobtc.btc.conf

<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName [url=http://www.example.com]www.example.com[/url]

        #Config minimale
	DocumentRoot /media/air-ubuntu/ec4283d9-c729-4f2e-8385-3ec51eafadf8/btc/www/hellobtc
        ServerName hellobtc.btc
       
	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

sudo gedit /etc/hosts

127.0.0.1	localhost
127.0.0.1 hellobtc.btc
127.0.1.1	airubuntu-MS-7721

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ping hellobtc.btc
PING hellobtc.btc (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.030 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.036 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.038 ms

Le server est présent avec ce ping
mais erreur 403 forbidden dans firfox sur la page --- http://hellobtc.btc/

Pouvez vous donner conseils ?
@+

Après installation de phpmyadmin, ce lien est valide :

http://hellobtc.btc/phpmyadmin/

C'est la config minimale du virtualhost qui ne fonctionne pas ..

/var/log/apache2/error.log :

[Wed Oct 26 15:26:40.955595 2016] [core:notice] [pid 5535] AH00094: Command line: '/usr/sbin/apache2'
[Wed Oct 26 15:26:48.201806 2016] [authz_core:error] [pid 5538] [client 127.0.0.1:48152] AH01630: client denied by server configuration: /media/air-ubuntu/ec4283d9-c729-4f2e-8385-3ec51eafadf8/btc/www/hellobtc/

Dernière modification par bmzoom (Le 28/10/2016, à 19:40)

Hors ligne

#2 Le 26/10/2016, à 16:21

Byggvir

Re : [Résolu : VirtualHost]Permission non accordée - Ubuntu 16.04

Ton serveur à les droits sur ton DocumentRoot ? fais un

ls -all 

à la racine de ton site pour voir si www-data a les droits sur les fichiers

Hors ligne

#3 Le 26/10/2016, à 17:17

bmzoom

Re : [Résolu : VirtualHost]Permission non accordée - Ubuntu 16.04

Le virtualhost porte sur media/... qui est une partition sur un disk number 2

air-ubuntu@airubuntu-MS-7721:/$ ls -all
total 108
drwxrwxrwx  24 root root  4096 oct.  25 10:06 .
drwxr-xr-x   3 root root  4096 sept.  3 11:34 home
drwxr-xr-x   3 root root  4096 sept.  3 12:01 media
drwxr-xr-x   2 root root  4096 oct.   5 14:16 mnt
drwxr-xr-x   3 root root  4096 sept.  4 18:36 opt
dr-xr-xr-x  13 root root     0 oct.  26 18:13 sys
drwxrwxrwt  11 root root  4096 oct.  26 18:09 tmp
drwxr-xr-x  11 root root  4096 oct.   5 14:24 usr
drwxr-xr-x  15 root root  4096 oct.  25 19:42 var
air-ubuntu@airubuntu-MS-7721:/$ ls
bin   cdrom  etc   initrd.img      lib    lost+found  mnt  proc  run   snap  sys  usr  vmlinuz
boot  dev    home  initrd.img.old  lib64  media       opt  root  sbin  srv   tmp  var  vmlinuz.old
air-ubuntu@airubuntu-MS-7721:/media$ ls -all
total 12
drwxr-xr-x   3 root root 4096 sept.  3 12:01 .
drwxrwxrwx  24 root root 4096 oct.  25 10:06 ..
drwxrwxrwx+  4 root root 4096 oct.  26 14:41 air-ubuntu

Un chmod sur media/ va maximiser tous les droits sur au moins 2 partitions disk
Et plus vu que d'autres sont possibles au fur et à mesure ( quand nécessaire .. )

var/ et media/ ont les mêmes droits

Dernière modification par bmzoom (Le 26/10/2016, à 18:35)

Hors ligne

#4 Le 26/10/2016, à 17:23

Byggvir

Re : [Résolu : VirtualHost]Permission non accordée - Ubuntu 16.04

Non mais je parlais des fichiers de ton site en l’occurrence les fichiers qui sont dans /www/hellobtc, c'est sur eux qu'il faut voir si apache à les droit d'accès dessus

Hors ligne

#5 Le 26/10/2016, à 17:37

bmzoom

Re : [Résolu : VirtualHost]Permission non accordée - Ubuntu 16.04

Les fichiers sont ici :

/media/air-ubuntu/ec4283d9-c729-4f2e-8385-3ec51eafadf8/btc/www/hellobtc
air-ubuntu@airubuntu-MS-7721:/media/air-ubuntu/ec4283d9-c729-4f2e-8385-3ec51eafadf8/btc/www/hellobtc$ 
ls -all
total 7844
drwxrwxrwx 34 air-ubuntu air-ubuntu    4096 août   4 09:24 .
drwxrwxrwx  3 air-ubuntu air-ubuntu    4096 oct.  26  2013 ..
drwxrwxrwx  3 air-ubuntu air-ubuntu    4096 juin  24  2015 0_balai
-rwxrwxrwx  1 air-ubuntu air-ubuntu      22 févr. 14  2013 phpinfo.php
...

C'est depuis le passage vers Ubuntu 16.04 que ce blocage persiste
Les mêmes partitions disk avec 14.04 ne posent aucun soucis
Avec phpinfo.php qui a tous les droits :
You don't have permission to access /phpinfo.php on this server.

Hors ligne

#6 Le 26/10/2016, à 17:42

Byggvir

Re : [Résolu : VirtualHost]Permission non accordée - Ubuntu 16.04

Ok j'avais pas bien compris, bon ce qu'il faut savoir c'est que Ubuntu 16.04 est avec PHP7.0 donc regarde de ce côté là

Hors ligne

#7 Le 26/10/2016, à 18:06

bmzoom

Re : [Résolu : VirtualHost]Permission non accordée - Ubuntu 16.04

Non, avant le virtualhost :

localhost dans var/www/html/phpinfo.php fonctionne et montre que php7 est bien installé

C'est l'installation du virtualhost qui foire avec ubuntu 16.04

[Résolu]
Il faut installer les droits du virtualhost dans apache.conf
/etc/apache/apache2.conf

PHP Version 7.0.8-0ubuntu0.16.04.3

ub-16-04.jpg

Dernière modification par bmzoom (Le 26/10/2016, à 18:28)

Hors ligne

#8 Le 26/10/2016, à 18:10

Byggvir

Re : [Résolu : VirtualHost]Permission non accordée - Ubuntu 16.04

Tu as bien ajouté le site ?

sudo a2ensite  hellobtc.btc.conf 

Tu as bien redémarré apache2 ?

sudo systemctl restart apache2

Apache à t'il les droits sur le dossier qui contient ton site ?

sudo chown www-data /media/air-ubuntu/ec4283d9-c729-4f2e-8385-3ec51eafadf8/btc/www/hellobtc 

Dernière modification par Byggvir (Le 26/10/2016, à 18:12)

Hors ligne