LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-18-2016, 02:41 AM   #1
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Rep: Reputation: Disabled
How can I get out of this?


I just installed httpd, mariadb and other basic things on the newest Centos7 and I am trying to run a website from that.

setenforce 1
--> 403 Permission denied in a browser (cant read .htaccess file in server logs)
senenforce 0
--> website showing php as source code (View Source Code in a browser), and this includes mysql database name, user and password

How to get out of this?

###Edit:
I tried using this (based on my notes made during the config of the previous systems, exactly the same), but it does not work, for some reason:

Code:
yum install policycoreutils-python
semanage fcontext -a -t httpd_sys_content_t "/home/www/html(/.*)?"
restorecon –R –v /home/www/html

Last edited by AdultFoundry; 06-18-2016 at 03:06 AM.
 
Old 06-18-2016, 03:13 AM   #2
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
Then check
1. if the file .htaccess exists
2. the file permissions of this file, if it exists
 
Old 06-18-2016, 03:20 AM   #3
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Keruskerfuerst View Post
Then check
1. if the file .htaccess exists
2. the file permissions of this file, if it exists
755, all /home/www/http/domain.com/.htaccess are 755. It used to be a little different actually (751 on the domain.com and 644 on the .htaccess file. this used to work somewhere else). I am not sure if setting all these to 755 is correct, probably not. All this is becoming a mess now.

If somebody is familiar, what are the commands that I can run on /home/www/html, to make sure that the permissions and ownership are correct? This is Centos7, apache, just root user. root is the owner of anything, apaches accesses with the permisssios for other, this is how it is suppose to be, I think. This looks like SeLinux though. I've been dealing with things like this for five full days now, trying to test a site and get it to work correctly / better. I had notes and the commands that I've been running were good on two systems already, this is the third one and something does not work (permissions issue of some kind). The site has not been up for like 14 hours now, and it gets around 500 people per day. And I've been changing things on it for like a week, so they may ban me in google.com, but probably not. Too much mess.

###Edit:
Looks like this is solved for now.

Last edited by AdultFoundry; 06-18-2016 at 04:56 AM.
 
Old 06-18-2016, 05:13 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Quote:
Originally Posted by AdultFoundry View Post
755, all /home/www/http/domain.com/.htaccess are 755. It used to be a little different actually (751 on the domain.com and 644 on the .htaccess file. this used to work somewhere else). I am not sure if setting all these to 755 is correct, probably not.
Files should be 644, directories 755 or 751. But that's kind of an aside. Since it's your server and you have root access to it, your configuration changes should go in the main configuration file which should be /etc/httpd/conf/httpd.conf or somewhere in /etc/httpd/conf.d/ depending on where you have your vhost information. .htaccess is for when you have to farm out a subset of capabilities to someone who doesn't have access to the vhost's configuration file.
 
1 members found this post helpful.
  


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



LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:04 PM.

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