Author |
|
alvaro
Joined: 11 May 2016 Posts: 8
|
Posted: Wed 11 May '16 21:10 Post subject: virtual host conf and 403 |
|
|
I have just read a similar title posted here, yet, I can't translate it to my case.
Apache/2.4.10 (Debian)
Debian Linux 8.4 Jessie
vps cloud web server menkisys.de
I have installed a PHP framework(Laravel) in this directory:
Code: | /var/www/virtual/myweb.net/htdocs |
1) Because Laravel serves its files from the public directory I created the virtual host by going to the Folder Apache2 sites-available and there already there was an empty file having the name of my website like this: myweb.net.conf (sort of waiting for me to configure it actually)
So I opened it and inserted this:
Code: | <VirtualHost *:80>
ServerName myweb.net
DocumentRoot "/var/www/virtual/myweb.net/htdocs/public"
<Directory "/var/www/virtual/myweb.net/htdocs/public">
AllowOverride all
</Directory>
</VirtualHost> |
Then I followed the instructions to do a sym links from the same-name file at sites-enabled to sites-available file. Got a 403
So, I went to apache2.conf and I tried to modify but I am afraid I am not properly doing it as the 403 lingers on.
This is how the relevant part looks like (I suspect the first block should not be like that, but I am very new to this):
UPDATE: trying to pick from ressembleable cases I have changed the relevant part of the code in apache2.conf and now it looks like this:
Code: |
<Directory />
AllowOverride none
Require all granted
Allow from all
</Directory>
<Directory /var/www/virtual/myweb.net/htdocs>
Options FollowSymLinks
AllowOverride None
Allow from all
</Directory>
<Directory /var/www/virtual/myweb.net/htdocs/public/*>
Options FollowSymLinks
AllowOverride None
Allow from all
</Directory>
|
The error log reads
Code: |
client denied by server configuration: /var/www/virtual/myweb.net/htdocs/public |
|
|
Back to top |
|
SaintGiff
Joined: 10 May 2016 Posts: 2 Location: US
|
Posted: Fri 13 May '16 16:46 Post subject: |
|
|
Did you update you your hosts file? You need to add the site to your hosts file and then restart apache.
Edit for clarity.
You need to open /etc/hosts and add your virtual hosts / IPs to that file. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 13 May '16 16:48 Post subject: |
|
|
Remove all
Allow from all and Order Allow,Deny
With apache 2.4 use only Require. e.g. Require all granted |
|
Back to top |
|
alvaro
Joined: 11 May 2016 Posts: 8
|
Posted: Fri 13 May '16 18:26 Post subject: |
|
|
SaintGiff wrote: | Did you update you your hosts file? You need to add the site to your hosts file and then restart apache.
Edit for clarity.
You need to open /etc/hosts and add your virtual hosts / IPs to that file. |
Hello
thank you for helping out, but I dont know how
all I have in that hosts file is this:
127.0.0.1 menkisyscloudsrv106.menkisys.de.local localhost
51.254.155.106 menkisyscloudsrv106.menkisys.de menkisyscloudsrv106
::ffff:51.254.155.106 menkisyscloudsrv106.menkisys.de menkisyscloudsrv106
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts |
|
Back to top |
|
alvaro
Joined: 11 May 2016 Posts: 8
|
Posted: Fri 13 May '16 18:50 Post subject: |
|
|
James Blond wrote: | Remove all
Allow from all and Order Allow,Deny
With apache 2.4 use only Require. e.g. Require all granted |
I have left it like this, but no change.
Code: | <Directory />
Require all granted
</Directory>
<Directory /var/www/virtual/myweb.net/htdocs>
Options FollowSymLinks
Require all granted
</Directory>
<Directory /var/www/virtual/myweb.net/htdocs/public/*>
Options FollowSymLinks
Require all granted
</Directory>
<Directory /usr/share>
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
Require all granted
</Directory> |
|
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Sat 14 May '16 9:15 Post subject: |
|
|
Since you changed that. What are the permissions of the file system? Is the apache user allowed to read that folder? |
|
Back to top |
|
alvaro
Joined: 11 May 2016 Posts: 8
|
Posted: Sat 14 May '16 9:47 Post subject: |
|
|
James Blond wrote: | Since you changed that. What are the permissions of the file system? Is the apache user allowed to read that folder? |
the file system structure is: /var/www/virtual/myweb.net/htdocs/and here is the laravel php framework:
var 755
www 755
virtual 755
myweb.net 750
htdocs 750
owner read write and ex
group read and execute
public nothing
I see Public has 0 permissions in htdocs
and inside htdocs is where the php framework Laravel is |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 24 May '16 20:46 Post subject: |
|
|
public nothing might be the problem. Depending with
user and group your apache is running. To what is it set in your apache config file? |
|
Back to top |
|
alvaro
Joined: 11 May 2016 Posts: 8
|
Posted: Tue 24 May '16 20:57 Post subject: |
|
|
James Blond wrote: | public nothing might be the problem. Depending with
user and group your apache is running. To what is it set in your apache config file? |
I have got this:
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
in the envvars file to which
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
are calling in apache2.conf |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 24 May '16 21:01 Post subject: |
|
|
ok, so is www-data the owner or in the group of the owner from that directories? |
|
Back to top |
|
alvaro
Joined: 11 May 2016 Posts: 8
|
Posted: Tue 24 May '16 21:14 Post subject: |
|
|
James Blond wrote: | ok, so is www-data the owner or in the group of the owner from that directories? |
hello I am struggling to find an answer to your question. I dont understand what a directory 'www-data' means since I dont have any named like that in the file directory tree seeing it from the FTP client the path that I have down to the Laravel application is the mentioned one:
/var/www/virtual/myweb.net/htdocs
what is that 'data' appended mean?
a weird thing is that when I try to change the permissions from the FTP client to include "Read" permission to htdocs, thus changing from 750 to 754, it just ignores my selection. it will not save it. By the way I never heard a 754 was a standard so I am not clear on that either. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 24 May '16 21:20 Post subject: |
|
|
"www-data" is a user on your server. Just like the one you one you can login via ssh.
Who is the owner and the group see an output from ls -l
Code: |
james@server:/$ ls -l
insgesamt 88
drwxr-xr-x 2 root root 4096 Apr 3 18:03 bin
drwxr-xr-x 5 root root 4096 Apr 11 11:31 boot
drwxr-xr-x 19 root root 3160 Apr 3 18:06 dev
drwxr-xr-x 103 root james 12288 Mai 24 16:10 some
drwxr-xr-x 103 james james 12288 Mai 24 16:10 some2
drwxr-xr-x 103 james www-data 12288 Mai 24 16:10 some
|
|
|
Back to top |
|
alvaro
Joined: 11 May 2016 Posts: 8
|
Posted: Tue 24 May '16 21:26 Post subject: |
|
|
James Blond wrote: | "www-data" is a user on your server. Just like the one you one you can login via ssh.
Who is the owner and the group see an output from ls -l
Code: |
james@server:/$ ls -l
insgesamt 88
drwxr-xr-x 2 root root 4096 Apr 3 18:03 bin
drwxr-xr-x 5 root root 4096 Apr 11 11:31 boot
drwxr-xr-x 19 root root 3160 Apr 3 18:06 dev
drwxr-xr-x 103 root james 12288 Mai 24 16:10 some
drwxr-xr-x 103 james james 12288 Mai 24 16:10 some2
drwxr-xr-x 103 james www-data 12288 Mai 24 16:10 some
|
|
Running that command I ve got this
Last login: Fri May 13 18:47:19 2016 from ki.up.ee
root@menkisyscloudsrv106:~# ls -l
insgesamt 75160
-rw-r--r-- 1 root root 12315811 Apr 30 15:10 1.2.13.tar.gz
-rwxr-xr-x 1 root root 1592154 Apr 30 19:58 composer.phar
drwxrwxr-x 10 root root 4096 Feb 24 13:59 imscp-1.2.13
-rw-r--r-- 1 root root 3322 Apr 18 22:34 menkisys.key.txt
-rw-r--r-- 1 root root 6829 Apr 18 22:36 ssl.zip
-rw-r--r-- 1 root root 63024310 Jun 1 2015 vm.tar.gz
drwxr-xr-x 7 root root 4096 Aug 23 2014 vmware-tools-distrib
-rw-r--r-- 1 root root 2497 Apr 30 15:17 wildcard.txt
-rw-r--r-- 1 root root 3409 Apr 30 15:17 x-intermediate.txt
root@menkisyscloudsrv106:~#
============
ok hold on I am going to move down to other directories
Last edited by alvaro on Tue 24 May '16 21:30; edited 1 time in total |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 24 May '16 21:28 Post subject: |
|
|
We are getting closer!
use
Code: |
cd /var/www/virtual/myweb.net/htdocs
ls -l
|
|
|
Back to top |
|
alvaro
Joined: 11 May 2016 Posts: 8
|
Posted: Tue 24 May '16 21:33 Post subject: |
|
|
James Blond wrote: | We are getting closer!
use
Code: |
cd /var/www/virtual/myweb.net/htdocs
ls -l
|
|
====================
this is actually the directory folders from Laravel, the PHP framework.
The file by "root" hola, I created it myself I think from the ftp editor. The vu2003 are the files that were uploaded from a web cloud provider that allows you to deploy your framework from github or bitbucket.
insgesamt 180
drwxr-x--- 10 vu2003 vu2003 4096 Mai 5 11:59 app
-rwxr-x--- 1 vu2003 vu2003 1646 Mai 5 11:59 artisan
drwxr-x--- 3 vu2003 vu2003 4096 Mai 5 11:59 bootstrap
-rwxr-x--- 1 vu2003 vu2003 1272 Mai 5 11:59 composer.json
-rwxr-x--- 1 vu2003 vu2003 108079 Mai 5 11:59 composer.lock
drwxr-x--- 2 vu2003 vu2003 4096 Mai 5 11:59 config
drwxr-x--- 5 vu2003 vu2003 4096 Mai 5 11:59 database
-rwxr-x--- 1 vu2003 vu2003 503 Mai 5 11:59 gulpfile.js
-rwxr-x--- 1 root root 4 Mai 5 11:12 hola
drwxr-x--- 2 vu2003 vu2003 4096 Apr 30 15:22 images
-rwxr-x--- 1 vu2003 vu2003 3814 Apr 30 15:22 index1.html
-rwxr-x--- 1 vu2003 vu2003 159 Mai 5 11:59 package.json
-rwxr-x--- 1 vu2003 vu2003 1026 Mai 5 11:59 phpunit.xml
drwxr-x--- 2 vu2003 vu2003 4096 Mai 5 11:59 public
-rwxr-x--- 1 vu2003 vu2003 1918 Mai 5 11:59 readme.md
drwxr-x--- 5 vu2003 vu2003 4096 Mai 5 11:59 resources
-rwxr-x--- 1 vu2003 vu2003 567 Mai 5 11:59 server.php
drwxr-x--- 5 vu2003 vu2003 4096 Mai 5 11:59 storage
drwxr-x--- 2 vu2003 vu2003 4096 Mai 5 11:59 tests |
|
Back to top |
|