Welcome! Log In Create A New Profile

Advanced

Issue with HttpAuthDigestModule

March 07, 2013 11:19PM
Hello Nginx people!

I hope you can help me. I'm having an infuriating problem with auth digest via the HttpAuthDigestModule.

The first site I added to Nginx used the same htdigest password file as my Apache webserver (on the same box) uses. This works fine. However, I added a second website that uses an almost identical configuration but for some reason I simply cannot authenticate for this second site. I'm using the same htdigest password file, same username and password. The first website I can authenticate, the second one refuses to authenticate me. I can't figure out why!

Here is the first website's conf file:
#########
# Project 1 configuration
upstream project1_backend {
server unix:/var/www/project_1/tmp/php.sock;
}

server {
listen 8083;
server_name dev.project_1.site.com;
root /var/www/project_1/web;

access_log /var/www/project_1/logs/nginx_access.log;
error_log /var/www/project_1/logs/nginx_error.log;

# strip app.php/ prefix if it is present
rewrite ^/app\.php/?(.*)$ /$1 permanent;

auth_digest_user_file /etc/apache-digest-passwd;

location / {
auth_digest 'my-realm';
index app.php;
try_files $uri @rewriteapp;
}

location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}

# pass the PHP scripts to FastCGI server listening on php socket
location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass project1_backend;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
}
#########

The second configuration file looks like this:
#########
# Project 2 configuration file
upstream project2_backend {
server unix:/var/www/project_2/tmp/php.sock;
}

server {
listen 8083;

server_name project_2.site.com;
root /var/www/project_2/web;

access_log /var/www/project_2/logs/nginx_access.log;
error_log /var/www/project_2/logs/nginx_error.log error;

# strip app.php/ prefix if it is present
rewrite ^/app\.php/?(.*)$ /$1 permanent;

auth_digest_user_file /etc/apache-digest-passwd;

location / {
auth_digest 'my-realm';
index app.php;
try_files $uri @rewriteapp;
}

location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}

# pass the PHP scripts to FastCGI server listening on php socket
# REMOVE config from choices on PRODUCTION!
location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass project2_backend;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
}
#########

I've tried creating a new password file with htdigest and adding a user/password to it, then referencing that new password file in the second website's conf file but I still can't authenticate.

Can anyone shed some light on this for me please?

Thanks for any help you can offer,

Alex
SubjectAuthorPosted

Issue with HttpAuthDigestModule

redleaderukMarch 07, 2013 11:19PM

Re: Issue with HttpAuthDigestModule

redleaderukMarch 08, 2013 06:41PM

Re: Issue with HttpAuthDigestModule

Francis DalyMarch 09, 2013 01:00PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 85
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready