By karpred
I hope someone can help me here. I just want to change the index.html to index.php, but when I do so I get the 403 forbidden error. I followed a bunch of tutorials on permission and installing php etc. to no avail. I am a complete newbie, so most of the time I don’t really know what I am doing but I am trying to follow the tutorials.
If someone could give me complete newbie intructions on how to solve this, I’d be very grateful. I learned how to access files and other simple stuff but not much more.
I am using nginx on ubuntu. With the html files my website works fine, but I need it .php to run something.
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!
Accepted Answer
Hi @karpred , I had to start new answer again :D Thanks for the latest result, and please provide one couple more. So, it will be two files: get_me_and_remove_me_2 and get_me_and_remove_me_3
1.
For sudoer:
sudo grep -e server_name -e root -e index -e include /etc/nginx/sites-available/* > ~/get_me_and_remove_me_2 && sudo cp /home/$USER/get_me_and_remove_me_2 /var/www/
For root:
grep -e server_name -e root -e index -e include /etc/nginx/sites-available/* > /var/www/get_me_and_remove_me_2
2.
For sudoer:
sudo ls -la /etc/nginx/sites-enabled/ > ~/get_me_and_remove_me_3 && sudo cp /home/$USER/get_me_and_remove_me_3 /var/www/
For root:
sudo ls -la /etc/nginx/sites-enabled/ > /var/www/get_me_and_remove_me_3
Hello @karpred,
You need to check 2 or 3 things In your domain’s Nginx configuration file.
The first is your root
or referred to as DocumentRoot directive. In your case it’s /var/www/html
but are you sure that’s where your files are located? Enter that directory and see if the files are there or located in another folder named after your domain. If it’s the second option just add the domain in your root directive :
root /var/www/html
to be
root /var/www/html/domain.com
That’s only if the files are in the said folder.
The next thing to change would be the server_name
server_name _;
You should change it to include your domain
server_name domain.com www.domain.com;
After you make those changes, restart nginx and see if your website works properly now.
Regards, KFSys
Hi,
Try the following steps.
1. Restart nginx service
sudo systemctl restart nginx
2. Run the command
curl http://your_droplet_ip/
3. In your Internet browser’s address bar enter:
http://your_droplet_ip/index.php
4. Clear Internet browser’s cache.
If it is still unsuccessfully, give us a results of step 2 and 3.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.