Link to home
Start Free TrialLog in
Avatar of LeTay
LeTay

asked on

Problem to access apache web server home page - WAMP Server and WordPress

I am starting to develop a small web site on my PC
I already have a ftp server on it, and using dynamic dns from no-ip I can access it with this name cbsl.ddns.net
I forwarded port 80 to my PC on my internet box (like I did for ftp ports)
Now I installed WAMPServer and then WordPress.
Everything looks to be correctly configurered (mySQL db created etc...)
In my browser, when I code localhost/CBSL, I get the WordPress home page
But when I code http://cbsl.ddns.net/cbsl, I get this error

Forbidden
You don't have permission to access /cbsl on this server.
Apache/2.4.9 (Win64) PHP/5.5.12 Server at cbsl.ddns.net Port 80

This shows that the connection works but it is refused.
What did I miss in the config ?
Thanks
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

Look at your httpd.conf (Apache conf file) near to the end of the file you should see something like
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

Open in new window


Change it to

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>

Open in new window

My WAMP installation has a line in the config in the tray that allows or denies external access.  Default is to deny access.
This can also happen if you don't have an index.htm our index.php file. Can you confirm that the directory route is both configured properly ( the directory exist) and that it hasn't index.html index.php file?
*Directory root. (Mobile / auto correct issues)
Avatar of LeTay
LeTay

ASKER

Much better with this Allow from all !!!
Avatar of LeTay

ASKER

Answer too quickly ..
Was still using localhost in the URL
Same result with cbsl.ddns.net > error as above
You hould post here your httpd-vhost.conf file and your HOSTS file contents, please. It could be a mismatch in the site name in these two files. If you don't want to post here these files, you can just check that the name of the DocumentRoot in the first file be identical to the site listed in HOSTS file.
Avatar of LeTay

ASKER

No such hosts file in my Windows 7 PC ...
Name is correct and anyway the apache server does answer ... with an error
So ?
No such hosts file in my Windows 7 PC ...
c:\Windows\System32\drivers\etc\
Name is correct and anyway the apache server does answer
This doesn't mean anything: Apache can respond with that error message if you're trying to access a site with a wrong name, otherwise I'd not suggested to check those files
WAMPServer's default httpd.conf will serve pages for localhost - if you look through the httpd.conf file, you'll see the following line:

ServerName localhost

This will usually be followed by the  <Directory /> block you've already edited - but it's still for the localhost.

Best way to handle this is to enable virtual hosts and then create an entry specifically for your new domain into the httpd-vhosts.conf file. Make sure your HOSTS file maps the domain to your local IP and you should be good to go.

In the httpd.conf file, remove the # from the following line:

#Include conf/extra/httpd-vhosts.conf

Now edit that httpd-vhosts.conf file and add a section for your new domain name. Something like this:

<virtualhost *:80>
      ServerName cbsl.ddns.net
      DocumentRoot "C:/path/to/your/files/public_html/"

      <Directory "C:/path/to/your/files/public_html/">
            AllowOverride All
            Order allow,deny
            Allow from all
      </Directory>
</virtualhost>

Now edit your HOSTS file and add the following (note - the file maybe hidden and/or readonly, and it doesn't have a file extension):

127.0.0.1      cbsl.ddns.net

Save all your files and restart Apache (from the WAMPServer menu)

If you set it up the way I've outlined, then you should get your files served when you call your domain - if you include a folder at the end of your domain name, then make sure your files are in the folder, so if you call:

http://cbsl.ddns.net/cbsl/

then make sure you files are in:

C:/path/to/your/files/public_html/cbsl/
Avatar of LeTay

ASKER

Thanks
I made all the changes you propose.
Now I get this :
You don't have permission to access /cbsl on this server.
Apache/2.4.9 (Win64) PHP/5.5.12 Server at cbsl.ddns.net Port 80
Add a file in there and call it directly. For example - add in a file called index.html and then make sure you append that to the url - it will identify whether this is a problem with it not serving a default index page or not serving any page.
Avatar of LeTay

ASKER

There is already a index.php there but whatever I put in the URL, even an non-existing file, I get the same permission error
In my httpd-vhosts.conf, I added as said this, (unremark it in the httpd-conf file) and restarted the service :
<VirtualHost *:80>
      ServerName cbsl.ddns.net
      DocumentRoot "C:/wamp/www/"
      <Directory "C:/wamp/www/">
            AllowOverride All
            Order allow,deny
            Allow from all
      </Directory>
</VirtualHost>
ASKER CERTIFIED SOLUTION
Avatar of LeTay
LeTay

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LeTay

ASKER

No other answer to the question did result in a 100 % solution
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>

this method worked for me. thanks so much.