I have a website running with Nginx and PHP-FPM (www.example.com), however when I try to access www.example.com/user/login to access its administration and put the correct login info, it just reload the login info page apparently, but seeing in Firefox Network console whats happening is a 302 error (Moved Temporarily) when trying to access www.example.com/index.php/panel/index which it must load right before you log into it.
It’s driving me crazy because after reading about it, it has to do with redirections, which I have none in my host or nginx configurations.
Please help me.
Here’s my vhost configuration:
server {
listen 80;
server_name example.com;
charset UTF-8;
access_log /var/log/nginx/example.access.log main;
error_log /var/log/nginx/example.error.log;
root /usr/share/nginx/html/example/;
index index.php index.html index.htm;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html/;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/example/index.php;
}
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php;
}
}
}
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!
Hi,
The issue appears to be with the regex in the
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php;
}
}
block - which attempts to redirect traffic, but if the regex is modified to
` rewrite ?(.*)$ /index.php;
this may address it.
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.