[SOLVED] How to change the WEB site directory?

Issues related to applications and software problems
Post Reply
Amatøren
Posts: 38
Joined: 2016/03/10 15:46:19

[SOLVED] How to change the WEB site directory?

Post by Amatøren » 2019/09/01 18:45:23

I have small system disks so I want my WEB directory to be on may 44 TB RAID6 disk. The raid is up and working.

I deleted the directory html (/var/www/html) and replaced it with a link called html that points (redirect) to /mnt/raid6/www/html

I have also tried to change DocumentRoot to /mnt/raid6/www/html in httpd.conf.

(Yes, I restarted the service after every change.)


The default demo WEB page is working. The problem is my own web page (it works on my old server where the directory html is on the system disk (default installation) ).

Now i got:

Code: Select all

Forbidden

You don't have permission to access /epg/ on this server.
epg is a sub directory under html.
Attachments
_20190901_203753.JPG
_20190901_203753.JPG (109.8 KiB) Viewed 437 times
Last edited by Amatøren on 2019/09/02 20:46:15, edited 1 time in total.

User avatar
TrevorH
Forum Moderator
Posts: 26936
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to change the WEB site directory?

Post by TrevorH » 2019/09/01 19:55:39

I deleted the directory html (/var/www/html) and replaced it with a link called html that points (redirect) to /mnt/raid6/www/html
That's going to cause you problems. The directory /var/www/html is owned by the httpd package and it will try to recreate it with the correct ownership and permissions (by its definition, not yours). That will blow up with an error if it is a symlink. You're probably better off bind mounting a directory to it.
CentOS 5 died in March 2017 - migrate NOW!
CentOS 6 goes EOL sooner rather than later, get upgrading!
Full time Geek, part time moderator. Use the FAQ Luke

Amatøren
Posts: 38
Joined: 2016/03/10 15:46:19

Re: How to change the WEB site directory?

Post by Amatøren » 2019/09/01 20:00:47

Thanks.

In fstab? Possible for an example?

User avatar
TrevorH
Forum Moderator
Posts: 26936
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to change the WEB site directory?

Post by TrevorH » 2019/09/01 20:14:40

Like

Code: Select all

/existing/directory/fullof/data /var/www/html none bind 0 0 
Test using mount --bind /thing/to/mount /place/to/mountit
CentOS 5 died in March 2017 - migrate NOW!
CentOS 6 goes EOL sooner rather than later, get upgrading!
Full time Geek, part time moderator. Use the FAQ Luke

Amatøren
Posts: 38
Joined: 2016/03/10 15:46:19

Re: How to change the WEB site directory?

Post by Amatøren » 2019/09/01 20:40:29

Thanks!

I will test it out tomorrow. No I see what I did wrong.

I got a clue from Google search, but didn't got the time to test it. It's the same as your tip.

Amatøren
Posts: 38
Joined: 2016/03/10 15:46:19

Re: How to change the WEB site directory?

Post by Amatøren » 2019/09/02 14:30:46

Mounting OK, but still same problem to access WEB page.

Code: Select all

mount --bind /mnt/raid6/www/html/ /var/www/html/

User avatar
TrevorH
Forum Moderator
Posts: 26936
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to change the WEB site directory?

Post by TrevorH » 2019/09/02 15:18:08

Try restorecon -RFv /var/www/html to reset teh selinux contexts to what they should be.
CentOS 5 died in March 2017 - migrate NOW!
CentOS 6 goes EOL sooner rather than later, get upgrading!
Full time Geek, part time moderator. Use the FAQ Luke

Amatøren
Posts: 38
Joined: 2016/03/10 15:46:19

Re: How to change the WEB site directory?

Post by Amatøren » 2019/09/02 19:19:21

Thanks again!

That fixed it!

Post Reply

Return to “CentOS 7 - Software Support”