How to reload and restart Nginx

This article contains information/examples using root/sudo/admin users. If you require sudo/admin access, you must upgrade to a Dedicated Server.

You should reload Nginx anytime you make a change to a configuration file. You can do this in the panel or by logging into your server via SSH with your admin user on a Dedicated Server.

Reloading in the panel (VPS and Dedicated Servers)

  1. Navigate to the VPS or Dedicated page.
  2. Click the Reload HTTP button.
  3. Wait 5 minutes for it to rebuild the configuration file.

Reloading via SSH (Dedicated Servers only)

Log into your server via SSH with your admin user. Then, run the following command:

[server]$ sudo /etc/init.d/nginx reload
  • Reloading keeps the server running while re-reading any configuration file updates.
  • Reloading is safer than restarting because if a syntax error is noticed in a config file, it will not proceed with the reload, and your server remains running.
  • If there is a syntax error in a config file and you restart, it's possible the server will not restart correctly.

Restarting (Dedicated Servers only)

You can restart Nginx with the following commands after logging into your server via SSH with your admin user:

[server]$ sudo /etc/init.d/nginx stop
[server]$ sudo /etc/init.d/nginx start

You can also restart in your DreamHost panel. Navigate to the VPS page, and then click the Restart button to the right of your server.

Updating your phprc file

If you've created a phprc file and see your phpinfo.php file has not updated, you have three options:

Update your site configuration in your panel

You can resave your site configuration in the panel to update your phprc file.

Reload Nginx (Dedicated Servers only)

If you're on a Dedicated Server with an admin user, you can reload Nginx using the steps above. If reloading doesn't update your changes, try restarting and killing off all PHP processes as shown below.

Restart Nginx and kill off PHP processes (Dedicated Servers only)

If you're on a Dedicated Server with an admin user, you can restart Nginx and kill off all running PHP processes. Run the following commands under your Dedicated admin user:

[server]$ sudo /etc/init.d/nginx stop
[server]$ pkill -9 php
[server]$ sudo /etc/init.d/nginx start

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?