LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-19-2017, 09:17 AM   #1
angeloxavier95
LQ Newbie
 
Registered: May 2017
Posts: 4

Rep: Reputation: Disabled
Alter DocumentRoot RedHat (FORBIDDEN 403)


I have a server on Azure using RedHat, I made the installation of apache, I changed the folder in DocumentRoot, however when I try to access it via browser it presents the error: Forbidden You do not have permission to access this server File: / etc / httpd / Conf / httpd.conf

Can someone help?

Note: When I do not change the folder and leave default I can see the default Apache page.

Code: https://paste.ofcode.org/327vK5N5QbGxXzQsTNh3gdL
 
Old 05-19-2017, 09:25 AM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Can you access the documentRoot as the same user as Apache is using?

Code:
su apache -s /bin/bash -
cd /mnt/sd/minhapasta
Also do you have selinux enabled?

Code:
# getenforce
Disabled
It will most likely be either of these two that is the issue, the easy route for selinux is to disable it but is less secure. You'd have to amend selinux itself however to fix that.

Also not sure how this is a "networking" issue.
 
Old 05-19-2017, 09:38 AM   #3
angeloxavier95
LQ Newbie
 
Registered: May 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by r3sistance View Post
Can you access the documentRoot as the same user as Apache is using?

Code:
su apache -s /bin/bash -
cd /mnt/sd/minhapasta
Also do you have selinux enabled?

Code:
# getenforce
Disabled
It will most likely be either of these two that is the issue, the easy route for selinux is to disable it but is less secure. You'd have to amend selinux itself however to fix that.

Also not sure how this is a "networking" issue.
The file that holds the SELINUX configuration is disabled, but in the getenforce command it appears Enabled. System restarted.

Code:
su apache -s /bin/bash -
cd /mnt/sd/minhapasta
Sorry, but I do not understand these lines. Introduced 'apache' command not found
 
Old 05-19-2017, 09:45 AM   #4
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by angeloxavier95 View Post
The file that holds the SELINUX configuration is disabled, but in the getenforce command it appears Enabled. System restarted.

Code:
su apache -s /bin/bash -
cd /mnt/sd/minhapasta
Sorry, but I do not understand these lines. Introduced 'apache' command not found
To disable selinux requires a restart, maybe it was set disabled and not restarted? Well if you have restarted now you can test.

Code:
su apache -s /bin/bash -
Switches you to the apache user, your configuration has the user down as "apache", as the apache user usually has a fake shell, the '-s' sets the shell to /bin/bash to enable login.
 
Old 05-19-2017, 10:46 AM   #5
angeloxavier95
LQ Newbie
 
Registered: May 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
SELINUX is disabled. But it continues with the same error.

Print error: http://imgur.com/a/sivnO

Last edited by angeloxavier95; 05-19-2017 at 10:47 AM.
 
Old 05-19-2017, 11:06 AM   #6
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by angeloxavier95 View Post
I have a server on Azure using RedHat, I made the installation of apache, I changed the folder in DocumentRoot, however when I try to access it via browser it presents the error: Forbidden You do not have permission to access this server File: / etc / httpd / Conf / httpd.conf

Can someone help?

Note: When I do not change the folder and leave default I can see the default Apache page.
The apache2 service/daemon on that host is deployed using /etc/httpd/conf/httpd.conf
In My Experience, there are few reasons to alter /etc/httpd/conf/httpd.conf

"To change the DocumentRoot so that it is not shared by the secure and the non-secure Web servers, refer to" Section 21.7, “Virtual Hosts”.

Leave /etc/httpd/conf/httpd.conf as it was, and in a terminal, issue
Code:
apache2ctl -S
Your output may be similar to this:
Code:
/etc/httpd/sites-enabled/000-default.conf
That is the correct file to add/or alter a DocumentRoot

Compare to https://www.centos.org/docs/5/html/D...he-config.html
or/and https://www.centos.org/docs/5/html/D...tualhosts.html

Let us know!

Last edited by Habitual; 05-19-2017 at 11:08 AM.
 
Old 05-19-2017, 12:03 PM   #7
angeloxavier95
LQ Newbie
 
Registered: May 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
I did not configure Virtual host because I have only to submit an application in php. Virtual host must be configured when I have more than one application that uses apache, correct?

When I put a file in var / www / html I can access, however my files can not stay in this location.

They should stay on another disk, so I want Apache to be started on this other disk.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Forbidden 403 marisac Ubuntu 3 04-19-2014 10:36 AM
403 forbidden said76 Linux - Server 1 12-17-2012 08:52 PM
Ubuntu server apache2 changing documentroot gives a 403 rnx Linux - Server 12 06-01-2010 10:12 AM
Apache - "403 forbidden" message on any DIR below DocumentRoot stevod333 Linux - Software 12 06-12-2006 04:58 AM
Apache is giving me 403 when changing DocumentRoot Lazy Foo' Linux - Software 7 01-30-2006 08:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration