Why am I getting a 403 error?

Bruce Gust
Bruce Gust used Ask the Experts™
on
I moved the Laravel site I was working on from one box to another. I can access the site just fine if I do http://localhost/new_nomas/public/index.php. However, if I try to configure my httpd-vhosts.config file to accommodate a "new_nomas.site" url, as I did on the other computer, I'm getting a "403 Forbidden" error.

I'm running Apache 2.4.41. Here's my httpd-vhosts.config file:

<VirtualHost *:80>
	ServerName nomas.site
	DocumentRoot c:/wamp/www/new_nomas/public
	<Directory "c:/wamp/www/new_nomas/public">
	AllowOverride All
    Require all granted
	</Directory>
</VirtualHost>

Open in new window


...and here's my "hosts" file from the Windows/System32/drivers/etc directory:


127.0.0.1 nomas.site

Everything is pretty much identical to what I had before, but when I attempt "nomas.site" in my URL, I get a "403 Forbidden" message.

I've adjusted the security permissions in all of the files...

What am I missing?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2018
Distinguished Expert 2018

Commented:
It could be down to your .htaccess file  - specifically the rewrite section. Have your tried to call your index.php page file directly:

http://nomas.site/index.php
Bruce GustPHP Developer

Author

Commented:
Hey, Chris!

When I try http://nomas.site/index.php, I get the same error.
Distinguished Expert 2017

Commented:
Double check your httpd.conf file's include directive whether the vhost file has to gave vhost-file.conf versus vhost-file.config

I think the vhost that includes your definition is not being included.
David FavorFractional CTO
Distinguished Expert 2018
Commented:
Might be permission or ownership on /wamp/www/new_nomas/public or the index.html file at that location.

Just refer to your error.log file for details of the 403 reason.

Likely a quick glance at your log file will be sufficient to fix the problem.
Distinguished Expert 2017
Commented:
The issue is not permissions. Note example in original question that
Http://localhost/new_nomas/public  works

Add log file directives and check the issue when you go to http://nomas.site you are hitting the default site and not your vhost

On Linux/UNIX on can run httpd -t DUMP_VHOSTS. ...   with additional parameters or apachectl to get the info on which virtualHost records it knows about.
Gave not use WAMP setup, so not sure whether the same options would work to confirm my suspecion that the issue is your file suffix is config while the include file possible is looking for .conf

Location of the file and its placement is important.
Bruce GustPHP Developer

Author

Commented:
Alright, guys...

First of all, Laravel seemingly keeps it error logs in storage/logs and the last error was 12/15/2019, so there's either no error being generated or something's wrong with the permissions. If there's a problem with the permissions, I can't tell.

I've changed the .htaccess file to no avail.

Whatever it is, it's one obstinate anomaly. I can't make this thing budge.

Any other suggestions?

BTW: I tried initiating a brand new laravel project just to rule out any kind of weirdness with the copying and pasting of an already existing project. Same problem. I can't initiate a virtual server for anything.
Bruce GustPHP Developer

Author

Commented:
I'm an idiot!

I found the apache_error.log file and it said that the directory that I was referencing didn't exist.

Well...

On my new box the root directory is wamp64 and not wamp.

Mystery solved!

Thanks!

Sorry it wasn't a more "technical" problem!
David FavorFractional CTO
Distinguished Expert 2018

Commented:
You're welcome!

Glad you got this solved!

Logs are your friends...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial