php - nginx 301 redirect loop -
i'm having problem nginx , php-fpm setup. seo friendly url's not working, , when try using direct route 301 redirect loop browser.
here nginx config
# redirect non-www www server { listen 8081; server_name mysiteurl.com; rewrite ^(.*) http://www.mysiteurl.com$1 permanent; } server { listen 8081; server_name www.mysiteurl.com; rewrite_log on; access_log /var/www/vhosts/mysiteurl.com/statistics/logs/access_log.nginx combined; error_log /var/www/vhosts/mysiteurl.com/statistics/logs/error_log.nginx warn; root /var/www/vhosts/mysiteurl.com/httpdocs; index index.php index.html index.htm default.html default.htm; if (!-e $request_filename) { rewrite ^(.+)$ /navigation.php?q=$1 last; } location / { try_files $uri $uri/ /navigation.php?q=$uri&$args; } # deny running scripts inside writable directories location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ { return 403; error_page 403 /403_error.html; } location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php-fpm/www9.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param script_filename $document_root$fastcgi_script_name; include /etc/nginx/fastcgi.conf; } location ~ /\. { access_log off; log_not_found off; deny all; } location ~* \.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js|ico|swf)$ { expires max; add_header pragma public; add_header cache-control "public, must-revalidate, proxy-revalidate"; access_log off; log_not_found off; } } server { listen 8081; server_name webmail.mysiteurl.com; error_log /var/log/httpd/webmail.mysiteurl.com.log warn; location / { proxy_pass http://webmail.mysiteurl.com:8080$request_uri; include /etc/nginx/proxy.conf; } location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|txt|srt|swf|zip|rar|html|htm|pdf)$ { root /usr/share/psa-horde ; expires 7d; } } server { listen 8081; server_name sitebuilder.mysiteurl.com; error_log /var/log/httpd/sitebuilder.mysiteurl.com.log warn; location / { proxy_pass http://myip:8080$request_uri; include /etc/nginx/proxy.conf; } } server { listen 8081; server_name lists.mysiteurl.com; error_log /var/log/httpd/lists.mysiteurl.com.log warn; location / { proxy_pass http://myip:8080$request_uri; include /etc/nginx/proxy.conf; } }
this htaccess file came script i'm running:
options +followsymlinks rewriteengine on addencoding gzip .gz addencoding gzip .gzip <filesmatch "\.(js.gz|js.gzip)$"> forcetype text/javascript </filesmatch> <filesmatch "\.(css.gz|css.gzip)$"> forcetype text/css </filesmatch> rewritecond %{request_uri} !^/index\.php rewritecond %{request_uri} !/ow_updates/index\.php rewritecond %{request_uri} !/ow_updates/ rewritecond %{request_uri} !/ow_cron/run\.php rewritecond %{request_uri} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$ [nc] rewriterule (.*) index.php
apache vhost, trying remove redirect port number in url. myurl.com goes myurl.com:8081
<virtualhost my.ip.address:8080> servername myurl.com:8080 serveralias www.myurl.com usecanonicalname off serveradmin "myadmin@email.com" documentroot /var/www/vhosts/myurl.com/httpdocs customlog /var/www/vhosts/myurl.com/statistics/logs/access_log plesklog errorlog /var/www/vhosts/myurl.com/statistics/logs/error_log <ifmodule mod_userdir.c> userdir /var/www/vhosts/myurl.com/web_users </ifmodule> <ifmodule mod_ssl.c> sslengine off </ifmodule> <directory /var/www/vhosts/myurl.com/httpdocs> <ifmodule sapi_apache2.c> php_admin_flag engine on php_admin_flag safe_mode on php_admin_value open_basedir "/var/www/vhosts/myurl.com/httpdocs:/tmp" </ifmodule> <ifmodule mod_php5.c> php_admin_flag engine on php_admin_flag safe_mode on php_admin_value open_basedir "/var/www/vhosts/myurl.com/httpdocs:/tmp" </ifmodule> options -includes -execcgi </directory> <directory /var/www/vhosts/myurl.com/web_users> <ifmodule sapi_apache2.c> php_admin_flag engine off </ifmodule> <ifmodule mod_php5.c> php_admin_flag engine off </ifmodule> </directory> </virtualhost>
Comments
Post a Comment