You are not logged in.

#1 2012-09-01 23:25:53

Shara
Member
Registered: 2012-09-01
Posts: 18

[SOLVED] XAMPP 1.8.0 + virtual hosts = 403 access forbidden

Hello, all. I am happy migrant from ubuntu to arch, but have problem, which i can't solve myself.
I need to setup xammp for local development.

My actions

  • Install last xampp from aur

  • Run lampp

  • Open locahost, there is "xampp welcome page"

  • Open localhost/phpmyadmin and get

xampp new xampp security concept, blablabla

    Okay, add "Require all granted" in httpd-xampp.conf

<Directory "/opt/lampp/phpmyadmin">
        AllowOverride AuthConfig Limit
        #Order allow,deny
        #Allow from all
        Require all granted
    </Directory>

    phpmyadmin came back smile


I need virtual hosts, structure will be

/home/$USER/Sites/{site1/index.html,site2,site3 etc.}

  • Uncomment include vhosts in httpd.conf

Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

  • Clear httpd-vhosts.conf and put there

<VirtualHost *:80>
        DocumentRoot "/home/shara/Sites/mysite"
        ServerName mysite
        ServerAlias www.mysite
        ErrorLog "/home/shara/Sites/mysite-error_log"
        CustomLog "/home/shara/Sites/mysite-access_log" common
    </VirtualHost>

  • Add new host in /etc/hosts

127.0.0.1 mysite

  • Set "User shara" and "Group www" in httpd.conf

<IfModule unixd_module>
User shara
# commented out by lampp compatibility check
#Group nogroup
Group www
</IfModule>

  • Add group "groupadd www"

  • Add user to group "usermod -aG www shara"

  • Change htdocs group "chgrp -R www /opt/lampp/htdocs"

  • Change sitedir group "chgrp -R www /home/shara/Sites"

  • Change htdocs chmod "chmod 2775 /opt/lampp/htdocs"

  • Change sitedir chmod "chmod 2775 /home/shara/Sites"

Run xampp

  • Open "mysite"

Access forbidden Error 403

  • Open "localhost"

Access forbidden Error 403

  • Open "localhost/phpmyadmin"

Existing configuration file (./config.inc.php) is not readable.

  • Oookay roll
        Set chmod 664 to /opt/lampp/phpmyadmin/config.inc.php

  • Open "localhost/phpmyadmin"
        phpmyadmin works, but nothing else

    XAMPP 1.7 worked perfect with this config. Where is the FAIL?

Last edited by Shara (2012-09-04 12:18:48)

Offline

#2 2012-09-04 12:18:56

Shara
Member
Registered: 2012-09-01
Posts: 18

Re: [SOLVED] XAMPP 1.8.0 + virtual hosts = 403 access forbidden

I did it.
phpmyadmin new security problem solved with set passwords with /opt/lampp/lampp security (NO require all granted in httpd-xampp.conf)
virtual hosts 403 problem solved with

New instruction:
*User name "shara" and group "www" is myown, you need to set yours

INSTALL

yaourt -S xampp

/opt/lampp/lampp security

VIRTUAL HOSTS

Uncomment including vhosts in "/opt/lampp/etc/httpd.conf" and set "User shara" and "Group www"

Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

<IfModule unixd_module>
User shara
# commented out by lampp compatibility check
#Group nogroup
Group www
</IfModule>

Clear "/opt/lampp/etc/extra/httpd-vhosts.conf" and add

<VirtualHost *:80>
        DocumentRoot "/home/shara/Sites/mysite"
        ServerName mysite
        ErrorLog "/home/shara/Sites/mysite/mysite-error.log"
        CustomLog "/home/shara/Sites/mysite/mysite-access.log" common
    <Directory "/home/shara/Sites/mysite">
       Require all granted
    </Directory>

</VirtualHost>

Add new host in /etc/hosts

127.0.0.1 mysite

Add group

groupadd www

Add user to group

usermod -aG www shara

Change htdocs group

chgrp -R www /opt/lampp/htdocs

Change sitedir group

chgrp -R www /home/shara/Sites

Change htdocs chmod

chmod 2775 /opt/lampp/htdocs

Change sitedir chmod

chmod 2775 /home/shara/Sites

Set phpmyadmin config chmod

chmod 664 /opt/lampp/phpmyadmin/config.inc.php

Run lampp

sudo /opt/lampp/lampp start

WIN ^_^

May i need to write archwiki manual?

Last edited by Shara (2013-02-28 17:07:22)

Offline

#3 2013-02-28 16:48:49

arcticboy
Member
Registered: 2013-02-14
Posts: 5

Re: [SOLVED] XAMPP 1.8.0 + virtual hosts = 403 access forbidden

This just saved me from a lot of frustration. Thank you.

Offline

#4 2013-02-28 17:41:11

Shara
Member
Registered: 2012-09-01
Posts: 18

Re: [SOLVED] XAMPP 1.8.0 + virtual hosts = 403 access forbidden

I got a notification by email that this post got new comment and found one mistake.
It's about "httpd-vhosts.conf". it's will be good to put log files to site directory like this:

ErrorLog "/home/shara/Sites/mysite/mysite-error.log"

And if you want - here is my small bash script made for toggling xampp and generate virtual hosts from directories with one click. Like with "denwer".

http://pastebin.com/KhNqxE7Q

Of course don't forget to change location variables!
And maybe you need (or don't need) notify-send utility, which i use for start/stop notification

If you want to start xampp without sudo password you need add permisssion in sudoers

Edit sudoers with nano text editor

sudo EDITOR=nano visudo

And add line in "User privilege specification" section
Set your username and path to script (I put it to /usr/local/sbin)

shara ALL=NOPASSWD: /usr/local/sbin/togglexampp

You should make it like this

Okay, now you can start/stop xampp without password with command

sudo togglexampp

Offline

#5 2013-03-23 19:22:05

I-sty
Member
From: Romania
Registered: 2012-11-30
Posts: 60
Website

Re: [SOLVED] XAMPP 1.8.0 + virtual hosts = 403 access forbidden

You are my Hero Shara !!!
Thank you very much your instructions.
This is solved my problem.

Who, please add this SOLUTION to the xampp Wiki.

Have a nice day Shara.

Offline

Board footer

Powered by FluxBB