Changing Nginx Settings

SpinupWP uses Nginx to serve web requests. The global nginx.conf file is located at /etc/nginx/nginx.conf. You should avoid editing this file unless you are sure you want to make a global change for every site on your server.

When you create a site in SpinupWP, a new Nginx config is created for that site with sensible and secure defaults and is located at:

/etc/nginx/sites-available/{DOMAIN}/{DOMAIN}

You are free to edit this file as you wish. However, you should not edit any lines that have the # Managed by SpinupWP comment as they are required for SpinupWP to work correctly.

Included Directories

There are 4 include statements in the site Nginx config that load all the conf files from specific directories. This makes the Nginx configs easier to manage and debug and is the recommended way of adding customizations to your site’s Nginx config. Instead of editing the site Nginx config directly, you would create a new conf file in one of the following “included” directories:

/etc/nginx/sites-available/{DOMAIN}/before

Included before the server block. For example, global Nginx directive overrides would go here.

/etc/nginx/sites-available/{DOMAIN}/server

Included before any location blocks. For example, custom redirects, custom file handling, cache exclusions, enabling CORS etc. would go here.

/etc/nginx/sites-available/{DOMAIN}/location

Included at the end of the PHP location block. For example, custom fastcgi configuration would go here.

/etc/nginx/sites-available/{DOMAIN}/after

Included after the server block. For example, custom server blocks would go here.

We use this same technique in SpinupWP itself to manage certain configs. For example, when you enable HTTPS for your site in SpinupWP we add a config to the following location with important configuration directives:

/etc/nginx/sites-available/{DOMAIN}/server/https.conf

To edit any Nginx config file you will need to have sudo access which means SSHing to your server as a Sudo user.

To verify that there are no issues with your Nginx configuration you can run:

sudo nginx -t

Remember to reload Nginx when making any changes to your Nginx config files:

sudo service nginx reload

Start Your 7-Day Free Trial

Start your SpinupWP journey today and spin up your first server within minutes.

Start Your Free Trial

No credit card required

Subscribe to get the latest news, updates and optimizations in performance and security.

Thanks for subscribing 👍

To receive awesome stuff, you'll need to head to your inbox and click on the verification link we sent you.
Make sure to check your "spam" folder or your "promotions" tab (if you have Gmail).
If you're still having trouble, then messages us at sudo@spinupwp.com.

You are already logged in

It looks like you are already logged in to SpinupWP.

Please log out of this account to continue.

Registration Successful

Thanks for registering for a new
SpinupWP account.

Before getting started, could you verify your email address by clicking on the link we just emailed to you?

SpinupWP

Free Trial

Start Your 7-Day Free Trial

No credit card required. All features included.

By signing up to SpinupWP, you agree to our Terms and Conditions.
For privacy related information, view our Privacy Policy.