Topic: Tips for configuring nginx

Topic type:

Splitting up your nginx config file and basic authentication with nginx

Created by Steven Upritchard, Kete Project for Katipo Communications, Ltd.

For shared hosts if you put them all into your nginx.conf file it can get pretty big so take each server out into its own config file. So in the http section of the nginx file just add

http {
  ...
  include server1.conf;
  include server2.conf;
}

then your server1.conf file would contain all of the settings for that server.

Basic HTTP authentication on nginx

location / {
  auth_basic	"Restricted";
  auth_basic_user_file  htpasswd;
  ...
}

then you htpasswd can be created using the htpasswd command and it just goes in the same folder as your nginx.conf, if you have configured you server for https you may have to do this in more than one place. 

http://wiki.codemongers.com/NginxHttpAuthBasicModule

Discuss This Topic

There are 0 comments in this discussion.

join this discussion