By Lex Gabrees
I just followed the tutorial for installing and securing PHPmyadmin with Nginx on ubuntu (https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-with-nginx-on-an-ubuntu-14-04-server).
Everything went well until I wanted to implement the authentication gate. I keep getting a 404 not found message, while I can’t find anything wrong with what I did (I hope I’m wrong though).
**I have virtual hosts setup as follows : **
/var/www/example1.com/html /var/www/example2.com/html /var/www/example3.com/html
In this setup I have made example1.com the DEFAULT and inside /var/www/example1.com/html I have create a symlink for Phpmyadmin with :** sudo ln -s /usr/share/phpmyadmin /var/www/example1.com/html.**
**The default (example1.com) serverblock looks like this : **
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on;
root /var/www/example1.com/html;
index index.php index.html index.htm;
server_name example1.com;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
#error_page 404 /404.html;
error_page 401 403 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location /phpmyadmin {
auth_basic "Admin Login";
auth_basic_user_file /etc/nginx/pma_pass;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
I have gone over this thing I don’t know how many times. I’ve even tried it in the original Nginx webroot. I’ve tried truning of Fail2ban and putting all jails as FALSE and nothing seems to stop the 404 not found message. The only thing that works is taking out the location directive and thus the gateway authentication.
Well, that’s about it … I hope someone can help me with this … Thanks in advance …
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
For anyone who has this problem after following the : https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-on-ubuntu-14-04 tutorial, keep in mind the following.
The problem seems to be in the line : error_page 401 403 404 /404.html;
When I take away the 401 out of the line, then the basic auth works fine …
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.