Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Archives for nginx

July 1, 2016

Restarting Nginx

Niginx is primarily a web server, but it can also run as a proxy server, load balancer and a HTTP cache.

If you’re running on Debian, Ubuntu, Red Hat or CentOS, the following are several ways of restarting Nginx.

# /etc/init.d/nginx restart
# /etc/init.d/nginx reload
# service nginx restart
# service nginx reload
# nginx -s reload

# /etc/init.d/nginx restart # /etc/init.d/nginx reload # service nginx restart # service nginx reload # nginx -s reload

The last example is more universal and will run in any Linux flavor.

July 2, 2015

Laravel Forge Edit .env

Laravel Forge was recently upgraded with several new features. You can now edit your .env file directly from within Forge. It’s easier and faster than adding each environmental variable. In addition, you can also create and manage Nginx load balancing servers to balance your application load. With Forge, you can now deploy a new server in just minutes from any of the three cloud hosting service providers: Linode, Digital Ocean and now Amazon Web Services.

June 24, 2015

WordPress Permalinks on Nginx

If you’re running WordPress on Nginx, you may have an issue with WordPress permalinks. This article explains nicely what you need to do to configure Nginx. What the article failed to do is mention the Nginx configuration filename and its location. The filename is nginx.conf, and it’s usually located in the directory /usr/local/nginx/conf, /etc/nginx, or /usr/local/etc/nginx, depending on your Linux distro.

# WordPress installed on root directory
location / {
  index index.php index.html index.htm;
  try_files $uri $uri/ /index.php?$args;
}
 
# WordPress installed on /blog sub-directory
location /blog/ {
    try_files $uri $uri/ /blog/index.php?$args;
}

# WordPress installed on root directory location / { index index.php index.html index.htm; try_files $uri $uri/ /index.php?$args; } # WordPress installed on /blog sub-directory location /blog/ { try_files $uri $uri/ /blog/index.php?$args; }

You need to reload Nginx for changes to take effect. For Ubuntu:

$ sudo service nginx restart
# or
$ sudo /etc/init.d/nginx restart

$ sudo service nginx restart # or $ sudo /etc/init.d/nginx restart

  • 1
  • 2
  • Next Page »
  • Cloud
  • Linux
  • Git

Copyright © 2012–2021