Hello everyone,
I just install Apache, MySQL and PHP. when I call http://server ip, it shows Apache Default Webpages. I change index.html file name to index.html.org from /var/www/html. And it doesn’t show Apache default web page.
After that I download html website template from google and all of files include index.html. But when I call http://server ip, it shows, You don’t have permission to access this resource. How can I solve it.
If my ways are wrong, please tell me how to upload webpages to apache webserver.
Thank you for your time.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
Hi, Besides all the things mentioned by @KFSys, SELinux may be an another possible cause of your issue, if it is installed and enabled, of course. To check if it is enabled, run:
Installed and enabled SELinux gives the output like:
I highlighted the results indicating that SELinux is enabled and enforces its policies. So, if you get the status as above, you can turn on SELinux permissive mode for troubleshooting purposes:
If you can get your website in the browser now, that may indicate that your website directories/files are labeled incorrectly, due to SELinux scheme. So, you need to check it out, and fix it. You mentioned that your website root directory is /var/www/html/. List its content with SELinux labels:
You will get something similar to:
I highlighted the correct label for website files and directories. If the label of your index file is different, you can add the correct one running:
Actually, that command adds label to /var/www/html/ directory and all its content. Then, you need to set up the added label as a default one.
Now you can turn on SELinux enforcing mode
Let me know if it works, pls.
More info on SELinux you can find here.
Hi @EiMonHtun,
So, you can check Apache’s DocumentRoot by viewing the following file :
In it, you should see a DocumentRoot. Usually, as you mentioned it’s /var/www/html. You can check just to be on the safe side.
Having said that, what I think you’ve done is created a new index.html with different ownership, most probably
root:root`` however Apache has specific group and user that needs to be. Usually it's
www-data:www-data``` however you can check that as well. Open the fileInside search for
It will show you what group and user you should create the files with. Once you know what it should be, you can use the chown command on the files you’ve added.
Regards, KFSys