How to Upload My Web Server after installation Apache, MySQL and PHP?

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 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.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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:

SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Max kernel policy version: 31

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:

sudo setenforce 0

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:

sudo ls -laZ /var/www/html/

You will get something similar to:

drwxr-xr-x. qq qq system_u:object_r:httpd_sys_content_t:s0 . drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 .. -rw-rw-r--. qq qq unconfined_u:object_r:httpd_sys_content_t:s0 index.html

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:

sudo semanage fcontext -a -t httpd_sys_content_t "/var/www/html(/.*)?"

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.

sudo restorecon -R -v /var/www/html

Now you can turn on SELinux enforcing mode

sudo setenforce 1

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 file


Inside 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