Hi There,
I’m a teacher at a school are we are trying to setup a Centos 7 Nginx server to host the kids work while they learn.
We followed the tutorial here at https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-on-centos-7
When we complete the setup, we get a “Welcome to nginx!” page instead of the example page we created for testing.
We have gone over the configuration and googled around for about an hour, we’d really like to get this up before the kids are back on Monday.
Can anybody help us please, and what conf files do you need us to post to assist in the troubleshooting.
Thank you =)
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!
If you copied their example verbatim, then NGINX is going to pull content from:
/usr/share/nginx/html
This is defined by the root directive in the server block. To point that to your own directory, you will need to change that directive to match your custom directory.
So if you’re using:
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
You’ll need to change root /usr/share/nginx/html; in the location / block. There are, however, better ways to setup server blocks, but for the purpose of setting up an example, that’s all that you need to do.
Once you save the changes, you’ll need to restart NGINX using:
systemctl reload nginx
or
systemctl restart nginx
If we throw PHP, NodeJS, or another language in to the picture, we need to change things around.
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.