Difference between revisions of "Nginx"

From EQdkp Plus
Jump to navigation Jump to search
(Created page with "Here are some hints for creating a nginx configuration. <source lang="yaml"> server { listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 de...")
 
Line 15: Line 15:
 
# =========================
 
# =========================
 
 
# Deny access to some folders. Please keep in mind, that there will be more if you install plugins etc.
+
# Deny access to some folders. Change the subfolder-name c3338889c07ac363fc08bc715b22c59c to the one of your installation.
 +
# Please keep in mind, that there will be more if you install plugins etc.
 
 
 
location ~ /data/c3338889c07ac363fc08bc715b22c59c/cache {
 
location ~ /data/c3338889c07ac363fc08bc715b22c59c/cache {
Line 31: Line 32:
 
location ~ \.php(/|$) {  
 
location ~ \.php(/|$) {  
 
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
 
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass 127.0.0.1:9090;
+
# With php5-cgi alone:
 +
fastcgi_pass 127.0.0.1:9000;
 +
# With php5-fpm:
 +
fastcgi_pass unix:/var/run/php5-fpm.sock;
 
fastcgi_index index.php;
 
fastcgi_index index.php;
 
include fastcgi_params;
 
include fastcgi_params;
Line 76: Line 80:
 
# concurs with nginx's one
 
# concurs with nginx's one
 
#
 
#
#location ~ /\.ht {
+
location ~ /\.ht {
# deny all;
+
deny all;
#}
+
}
 
}
 
}
 
</source>
 
</source>

Revision as of 17:31, 3 July 2015

Here are some hints for creating a nginx configuration.

server {
	listen   80; ## listen for ipv4; this line is default and implied
	#listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

	root /var/www/nginx;
	index index.html index.htm index.php;

	# Make site accessible from http://localhost/
	server_name localhost;
	
	# START EQDKP CONFIGURATION
	# =========================
	
	# Deny access to some folders. Change the subfolder-name c3338889c07ac363fc08bc715b22c59c to the one of your installation. 
	# Please keep in mind, that there will be more if you install plugins etc.
	
	location ~ /data/c3338889c07ac363fc08bc715b22c59c/cache {
		deny all;
	}
	location ~ /data/c3338889c07ac363fc08bc715b22c59c/eqdkp/(backup|timekeeper|config) {
		deny all;
	}
	location ~ /data/c3338889c07ac363fc08bc715b22c59c/tmp {
		deny all;
	}
	
	# Configuration of php Files
	# Maybe you have to adjust fastcgi_pass unix:/var/run/php5-fpm.sock;
	location ~ \.php(/|$) { 
		fastcgi_split_path_info ^(.+?\.php)(/.*)$;
		# With php5-cgi alone:
		fastcgi_pass 127.0.0.1:9000;
		# With php5-fpm:
		fastcgi_pass unix:/var/run/php5-fpm.sock;
		fastcgi_index index.php;
		include fastcgi_params;
	}
	
	# SEO URLs. Here you have to change your install directory
	location / {
		index index.php;
		try_files $uri $uri/ /index.php/$uri?$args;
	}
	
	# END EQDKP CONFIGURATION
	# =========================

	# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
	#location /RequestDenied {
	#	proxy_pass http://127.0.0.1:8080;    
	#}

	#error_page 404 /404.html;

	# redirect server error pages to the static page /50x.html
	#
	#error_page 500 502 503 504 /50x.html;
	#location = /50x.html {
	#	root /usr/share/nginx/www;
	#}

	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
	#
	#location ~ \.php$ {
	#	fastcgi_split_path_info ^(.+\.php)(/.+)$;
	#	# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
	#
	#	# With php5-cgi alone:
	#	fastcgi_pass 127.0.0.1:9000;
	#	# With php5-fpm:
	#	fastcgi_pass unix:/var/run/php5-fpm.sock;
	#	fastcgi_index index.php;
	#	include fastcgi_params;
	#}

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	location ~ /\.ht {
		deny all;
	}
}