Difference between revisions of "Nginx"

From Bashlinux
Jump to: navigation, search
 
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
== How to serve phpmyadmin from a custom path ==
+
=== How to serve phpmyadmin from a custom path ===
On Debian systems, phpmyadmin is installed by default on `/usr/share/phpmyadmin`, so in order to don't break things the recommended configurations is as follows:
+
On Debian systems, phpmyadmin is installed by default on <tt>/usr/share/phpmyadmin</tt>, so in order to don't break things the recommended configurations is as follows:
 
location /phpmyadmin {
 
index index.php;
 
root /usr/share;
  +
}
 
 
 
location ~ ^/phpmyadmin.+.php$ {
<pre><nowiki>
 
location /phpmyadmin {
+
root /usr/share/phpmyadmin;
 
access_log /var/log/nginx/phpmyadmin.access_log;
index index.php;
 
  +
error_log /var/log/nginx/phpmyadmin.error_log;
root /usr/share;
 
 
rewrite /phpmyadmin$ /phpmyadmin/index.php;
}
 
  +
rewrite ^/phpmyadmin(/.+)$ $1 break;
 
 
location ~ ^/phpmyadmin.+.php$ {
 
 
fastcgi_index index.php;
root /usr/share/phpmyadmin;
 
 
fastcgi_pass 127.0.0.1:9000;
access_log /var/log/nginx/phpmyadmin.access_log;
 
error_log /var/log/nginx/phpmyadmin.error_log;
+
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin/$fastcgi_script_name;
 
include fastcgi_params;
rewrite /phpmyadmin$ /phpmyadmin/index.php;
 
  +
}
rewrite ^/phpmyadmin(/.+)$ $1 break;
 
 
fastcgi_index index.php;
 
fastcgi_pass 127.0.0.1:9000;
 
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin/$fastcgi_script_name;
 
include fastcgi_params;
 
}
 
</nowiki></pre>
 
 
   
== How to serve an svn directory ==
+
=== How to serve an svn directory ===
 
Forwarding the svn requests to Apache running on port 81
 
Forwarding the svn requests to Apache running on port 81
 
<pre><nowiki>
 
 
location /svn {
 
location /svn {
 
proxy_pass http://localhost:81;
 
proxy_pass http://localhost:81;
Line 34: Line 28:
 
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 
}
 
}
</nowiki></pre>
 

Latest revision as of 02:05, 6 June 2015

How to serve phpmyadmin from a custom path

On Debian systems, phpmyadmin is installed by default on /usr/share/phpmyadmin, so in order to don't break things the recommended configurations is as follows:

location /phpmyadmin {
		index index.php;
		root /usr/share;
	}

	location ~ ^/phpmyadmin.+.php$ {
		root /usr/share/phpmyadmin;
		access_log /var/log/nginx/phpmyadmin.access_log;
		error_log  /var/log/nginx/phpmyadmin.error_log;
		rewrite /phpmyadmin$ /phpmyadmin/index.php;
		rewrite ^/phpmyadmin(/.+)$ $1 break;

		fastcgi_index index.php;
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin/$fastcgi_script_name;
		include fastcgi_params;
	}

How to serve an svn directory

Forwarding the svn requests to Apache running on port 81

 location /svn {
               proxy_pass http://localhost:81;
               proxy_set_header X-Real_IP $remote_addr;
               proxy_set_header Host $host;
               proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       }