solved 403 Forbidden error after server migration

pch
@pch
5 years ago
328 posts
Hello I am having a weird issue after moving my Jamroom site from a server to another VPS.

I've followed all the server migration instructions, uploaded the files to the new server and edited the config.php file with the server/database details.

Jamroom is installed in a sub-directory but I am having the following error trying to access the site: mysitehere.com/jamroomdirectoryhere/

Forbidden
You don't have permission to access /jamroomdirectoryhere/ on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

In the Error log in cPanel, there is the following error:

[Mon Jul 22 20:12:28.751399 2019] [autoindex:error] [pid xxxx:tid xxxxxxxxxxxxxx] [client xxx.xxx.xx.xx:xxxx] AHxxxxx: Cannot serve directory /home/xxxxxx/public_html/jamroomdirectoryhere/: No matching DirectoryIndex (index.php,index.php5,index.php4,index.php3,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.jp,index.phtml,index.shtml,index.xhtml,index.html,index.htm,index.wml,Default.html,Default.htm,default.html,default.htm,home.html,home.htm,index.js) found, and server-generated directory index forbidden by Options directive.

I have contacted the web hosting company, they asked me to contact the script vendor because the site is missing a index.html file. I told them that Jamroom doesn't have a index file and the site was working just fine in my previous hosting plan of the same hosting company but they couldn't assist any further.

Please help me fix this issue.

Thanks in advance.
updated by @pch: 11/11/19 03:19:46AM
brian
@brian
5 years ago
10,148 posts
Check the following:

1) You copied the .htaccess file in to the directory (most likely this is the issue)
2) Make sure the "jamroomdirectoryhere" is owned by the WEB USER and not your FTP account

Let me know if that helps.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
pch
@pch
5 years ago
328 posts
Hey Brian.

Thanks for your reply. Long time! I am back. :)

No problem with Option #1. The .htaccess file is already in /jamroomdirectoryhere/.

Option #2 is more likely the solution to this issue because i remember that I created this directory using ftp.

By the way how to change the ownership so that the directory is owned by the Web User and not the FTP account? I am using WHM with cPanel.

Many Thanks
brian
@brian
5 years ago
10,148 posts
Glad to see you back - it's been a few years :)

To view/change ownership you will probably have to use the file manager in your control panel - to be honest I am not sure how to do that, but hopefully that points you in the right direction.

Let me know if that helps.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
pch
@pch
5 years ago
328 posts
Yep Brian. Thanks :)

Here is the message that i received from the Hosting support team after openning a ticket:

-----------------------------

Hello,

This error just means the server doesn't know which file it should be serving when the site is running. There must always be a specific file the server used to load to serve up your website. Most of the time, it is by default named index.html, index.php (if it's a PHP script), or anything you want. But If it isn't named the common name, you then must let the server know which file to load (which is the function of DirectoryIndex). Even if previously you were just using https://www.mysitehere.com/jamroomdirectoryhere/ without a file name at the end, the server was always loading a specific file.

Looking at your current director, I am unclear what is your default site file suppose to be.

./ data/ favicon.ico install.php license.txt repair.php.html skins/
../ error_log .htaccess install.txt modules/ robots.txt

None of these files look to be a website default file. Please let us know what the main site file is and we can set the DirectoryIndex to use that as the default file.

Please let us know if you have any further questions.

xxxxxxxxx

-----------------------------

Well, I am very surprised why they are asking me to specify a default site file. I have just done a site migration from a server to another within the same Hosting Company. On my previous server (in the same hosting company) Jamroom was just installed fine and was working perfectly without me having to contact them to specify a default site file.

I am suspecting that it is a Apache setting ( httpd.conf) issue on my new VPS as read in these forum topics:

https://stackoverflow.com/questions/10873295/error-message-forbidden-you-dont-have-permission-to-access-on-this-server

https://stackoverflow.com/questions/10445455/apache-dont-have-permission-to-access-on-this-server-when-i-am-using-virtua

https://stackoverflow.com/questions/21551840/forbidden-you-dont-have-permission-to-access-on-this-server

Anyway, please can you tell me what is the default site file I should tell them to specify in the DirectoryIndex function?

Thanks.
michael
@michael
5 years ago
7,717 posts
pch:.....There must always be a specific file the server used to load to serve up your website. Most of the time, it is by default named index.html, index.php .....
There is no default file.

The .htaccess fiile tells apache_rewrite to direct all incoming requests into a module, specifically /modules/jrCore/router.php (but you shouldn't need to do anything with that info)

Check that apaches mod-rewrite is enabled for the server.

If it is, then go over the other Server Requirements outlined here:

Docs: "Server Requirements"
https://www.jamroom.net/the-jamroom-network/documentation/getting-started/774/server-requirements
brian
@brian
5 years ago
10,148 posts
If your .htaccess file is already there, then it means your hosting provider has limited your ability to use .htaccess files in your directories. They should be able to assist you with this and tell you the exact error from the web server error log.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
pch
@pch
5 years ago
328 posts
Hello @brian and @michael,

Thank you all for your replies. This is a very weird issue I am having. I have been migrating and upgrading server in the past within the same hosting company without any problem with Jamroom at all. It is for the first time i having this problem with Jamroom within the same hosting company.

I did some tests: I have tried to install a fresh copy of Jamroom (JR 6.3.0) in another sub-directory on the same server. The installation when well and Jamroom is working perfectly.

So i think that it is not a .htaccess restriction problem because this new installation is working fine. Also the server doesn't have any problem to work with scripts that don't have a default index.html or index.php file.

by the way, Mod mod-rewrite is enable and the server meets all the Jamroom requirements because this new JR installation is working perfectly.

Then I did another test:

if I upload the jrCore file taken from the JR 6.3.0 zip pack to my modules/ directory on the server where there is the site I have migrated, then the 403 erro disappears.

I suspect that it has something to deal with the jrCore module.

I have checked on the server (on the JR having problem):

There are many jrCore release from:

jrCore-release-6.1.1
to
jrCore-release-6.3.0b4

but unfortunately there is not any "jrCore" directory.

Isn't it the cause of my issue? because in the .htaccess it says:

DirectoryIndex modules/jrCore/router.php

not

DirectoryIndex modules/jrCore-release-6.3.0b4/router.php

Please help. I am lost with this issue. Even my hosting company can't figure out where is the problem.

Thanks in advance.
michael
@michael
5 years ago
7,717 posts
Under those circumstances I would copy the /modules directory from the working jamroom install over to the non-working install and see what happens.

Rename (or backup/delete) the current /modules.

Seems like a good first step.

Would also copy the hidden /.htaccess from the working version too.

--edit--
Another possibility is: symlinks

The base location for a module is on a directory without its version number.

eg:
/modules/jrCore

When a new jrCore is updated from the marketplace, the current jrCore will move to a version number
/modules/jrCore-version-1.2.3
/modules/jrCore-version-1.2.4
/modules/jrCore-version-1.2.5

But the base
/modules/jrCore
will point to the highest version number via a symlink on /modules/jrCore

Its totally valid to keep just the most recent version of any of the modules and remove its version number, then delete the others, so if you had
/modules/jrCore-version-1.2.3
/modules/jrCore-version-1.2.4
/modules/jrCore-version-1.2.5

you could rename
/modules/jrCore-version-1.2.5
to
/modules/jrCore

and delete:
/modules/jrCore-version-1.2.3
/modules/jrCore-version-1.2.4

Then when the marketplace did its update it would re-add a new symlink


updated by @michael: 07/29/19 08:50:27PM
pch
@pch
5 years ago
328 posts
Dear @michael

Thank you so much. You saved my life. It works! :)

I have copied the /modules directory from the working jamroom install (Lastest JR install) over to the non-working install (migration using my backup). Same with the /.htaccess file.

One more thing I had to do is to re-upload my other installed and paid module files (from the backup) to this new working modules folder. e.g.: jrAudio, jrComment, jrVideo, jrYouTube etc.

I renamed e.g:
/modules/jrAudio-version-1.2.5
to
/modules/jrAudio

and I deleted:
/modules/jrAudio-version-1.2.3
/modules/jrAudio-version-1.2.4

Then I updated them from the marketplace. I did it with all the paid modules. Everything is working fine now.

Please, could you tell me what was definately the cause of this issue? I have been doing server migrations and upgrages, I have never came across such a problem before.

Thanks for the support.
michael
@michael
5 years ago
7,717 posts
Sounds like the symlinks did not get created correctly on your new server.

cant guess at why though.
pch
@pch
5 years ago
328 posts
Thank you :)

Tags