Welcome! Log In Create A New Profile

Advanced

Permanent Redirect on nginx

Mumanyi, Bravismore
April 28, 2016 10:48AM
Dear Nginx Community

My org has changed domain from unam.na to unam.edu.na. I intend to effect a permanent redirect on Nginx.

I have tried the lines in bold below but browsers are complaining of too many redirects.

Any tips on how I can adjust the config file for permanent redirect?

-----------------------Complete config file under sites-enabled---------------------------------------

server {

listen 80;
root /usr/share/nginx/atom;

# http://wiki.nginx.org/HttpCoreModule#server_name
# _ means catch any, but it's better if you replace this with your server
# name, e.g. archives.foobar.com
server_name _;
#server_name archives.unam.na;
#return 301 $scheme://archives.unam.edu.na;

#server_name archives.unam.na;
#rewrite ^ http://archives.unam.edu.na$request_uri? permanent;

client_max_body_size 72M;

# http://wiki.nginx.org/HttpCoreModule#try_files
location / {
try_files $uri /index.php?$args;
}

location ~ /\. {
deny all;
return 404;
}

location ~* (\.yml|\.ini|\.tmpl)$ {
deny all;
return 404;
}

location ~* /(?:uploads|files)/.*\.php$ {
deny all;
return 404;
}

# This is the most important part, as here we are redirecting some specific
# requests to PHP-FPM so PHP can do its job passing data to and from the
# web server.
location ~ ^/(index|qubit_dev)\.php(/|$) {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm.atom.sock;
}

location ~* \.php$ {
deny all;
return 404;
}

}
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Permanent Redirect on nginx

Mumanyi, Bravismore April 28, 2016 10:48AM

Re: Permanent Redirect on nginx

Francis Daly April 28, 2016 01:16PM

RE: Permanent Redirect on nginx

Mumanyi, Bravismore April 29, 2016 03:34AM

Re: Permanent Redirect on nginx

Francis Daly April 30, 2016 03:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 105
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready