Hi all,
I have my Flask test app from the tutorial up and running, it works well on my IP, I’m super happy about that.
However I have bought a Domain name www.trounceem.co.uk and pointed it at my IP 46.101.73.179 however I get a Nginx splash screen saying my server needs setting up.
its this splash screen: Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required
Is this something I need to change on my droplet or is it somethign I need to take to my Domain provider??
Thanks in advance for helping a noob.
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!
What do you currently have in your nginx configuration? On ubuntu the config file for the server blocks you are hosting would be in /etc/nginx/sites-enabled/
Heya all,
You need to create a reverse proxy with Nginx.
Create or edit your NGINX configuration file: This file is typically located in /etc/nginx/sites-available/. You can create a new file specific for your Django project. For instance, your_project.conf.
Basic Configuration:
server_name directive to define your domain or IP address.Static and Media Files:
Security and Performance Enhancements (optional):
Here is a simplified example of what the NGINX configuration file (your_project.conf) might look like:
server {
listen 80;
server_name example.com www.example.com; # Replace with your domain name
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /path/to/your/mysite; # Replace with your Django project's root directory
}
location /media/ {
root /path/to/your/mysite; # Replace with your Django project's root directory
}
location / {
proxy_pass http://localhost:8000; # Assuming Django runs on the 8000 port
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Optional: Security and Performance enhancements
# add_header X-Frame-Options SAMEORIGIN;
# add_header X-Content-Type-Options nosniff;
# add_header X-XSS-Protection "1; mode=block";
# gzip on;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
}
Important Notes:
/path/to/your/mysite with the actual path to your Django project.proxy_pass directive should point to the host and port where your Django app server (like Gunicorn) is running./etc/nginx/sites-enabled/.sudo nginx -t.Remember, this is a basic setup and might need adjustments based on your specific requirements, like handling HTTPS, more complex routing, load balancing, etc.
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.