<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>It sounds to me like wordpress believes that www is required and nginx doesn't want it.</p>
<p>I'd try commenting out the redirect server{} block and add the server_name to the xxx.com one and see what you end up with in your browser, then have a look through the wordpress settings to see what it's wanting in the address bar.</p>
<p>For my wordpress there seems to be 2 options under Settings/General, "Wordpress Address (URL)" and "Site Address (URL)".</p>
<p>On 12/04/2016 15:32, Muhammad Yousuf Khan wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div dir="ltr">
<div>
<div>
<div>Dear All,<br /><br /></div>
I am very new to nginx and trying to learn it from very basic. i have a website and i am willing to remove the "www" before my actual domain name. the solution so far i have find out on google is very simple. <br /><br /></div>
so when ever any of the visitor visits my website by using <a href="http://www.xxx.com">www.xxx.com</a> he should be redirected to <a href="http://xxx.com">xxx.com</a>. fortunately everything is working as expected i can load php files and html file correctly, however when i try to load my  actual website my browser shows error "redirection loop created"</div>
<br />here is the config code of my website.<br />
<div><br />server {<br />server_name <a href="http://www.xxx.com">www.xxx.com</a>;<br />return 301 $scheme://<a href="http://xxx.com">xxx.com</a>$request_uri;<br />}<br />
<div><br />server {<br />server_name <a href="http://xxx.com">xxx.com</a>;<br />root /var/www/html/xxx/public_html;<br />index index.php info.php;<br />access_log /var/log/nginx/<a href="http://xxx.com/access.log">xxx.com/access.log</a>;<br />error_log /var/log/nginx/<a href="http://xxx.com/error.log">xxx.com/error.log</a>;<br /><br />location / {<br />try_files $uri $uri/ /index.php?q=$request_uri;<br />}<br /><br />rewrite /wp-admin$ $scheme://$host$uri/ permanent;<br /><br /><br />location ~ \.php$ {<br />include fastcgi_params;<br />fastcgi_split_path_info ^(.+\.php)(/.+)$;<br />#fastcgi_pass unix:/var/run/php5-fpm.sock;<br />fastcgi_pass  <a href="http://127.0.0.1:9000">127.0.0.1:9000</a>;<br />fastcgi_index index.php;<br />fastcgi_param SCRIPT_FILENAME $request_filename;<br />}<br /><br />location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|woff|woff2)$ {<br />add_header Access-Control-Allow-Origin <a href="http://xxx.com">xxx.com</a>;<br /><br />}<br /><br />}<br /><br /><br /><br /></div>
<div>I can access  php files properly like info.php. to check whether php is working or not. however the problem part is wordpress.<br /><br /></div>
<div>when i try to load my wordpress site chrome shows an error saying reduction loop occur. <br /><br /></div>
<div>Any friendly advice will be highly appreciated.<br /><br /></div>
<div>Thanks,</div>
<div>Yousuf</div>
</div>
</div>
<br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">_______________________________________________<br /> nginx mailing list<br /> <a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br /> <a href="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a></div>
</blockquote>
<p><br /></p>

</body></html>