Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- user www;
- worker_processes 4;
- pid /var/run/nginx.pid;
- events {
- worker_connections 1024;
- multi_accept on;
- }
- http {
- ##
- # Basic Settings
- ##
- expires max;
- sendfile on;
- tcp_nopush on;
- tcp_nodelay on;
- keepalive_timeout 65;
- types_hash_max_size 2048;
- server_tokens off;
- # server_names_hash_bucket_size 64;
- # server_name_in_redirect off;
- include /usr/local/etc/nginx/mime.types;
- default_type application/octet-stream;
- set_real_ip_from 192.168.10.1; #Put the Ip of your varnish/proxy here
- real_ip_header X-Forwarded-For; #Put the Header that your varnish/proxy set
- ##
- # Logging Settings
- ##
- access_log /var/log/nginx-access.log;
- error_log /var/log/nginx-error.log;
- ##
- # Gzip Settings
- ##
- gzip on;
- gzip_disable "msie6";
- # gzip_min_length 1024;
- gzip_min_length 640;
- gzip_vary on;
- gzip_proxied any;
- gzip_comp_level 6;
- gzip_buffers 16 8k;
- gzip_http_version 1.1;
- gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
- # Virtual Host Configs
- server {
- # listen 8080;
- listen 8080 default_server accept_filter=httpready;
- root /usr/local/www/nginx/;
- index index.php index.html index.htm;
- # index index.html index.htm;
- server_name testbed.test.zip;
- fastcgi_intercept_errors on;
- error_page 500 502 503 504 400 403 404 /notfound.html;
- # Deny certain User-Agents (case insensitive)
- # The ~* makes it case insensitive as opposed to just a ~
- if ($http_user_agent ~* (Baiduspider|ZmEu|Morfeus\ Fucking\ Scanner|xmlset_roodkcableoj28840ybtide|DataCha0s/2.0|masscan/1.0|Zollard|CrowdStrike\ ShellShock\ Scanner/1.0|x00_-gawa.sa.pilipinas.2015) ) {
- return 418;
- }
- location / {
- try_files $uri $uri/ /index.php;
- if (!-e $request_filename){
- rewrite ^/(.*)$ /index.php?/$1? last;
- }
- }
- # Below is Expression Engine section
- location /index.php {
- set $script $uri;
- set $path_info "";
- if ($uri ~ "^(.+\.php)(/.+)") {
- set $script $1;
- set $path_info $2;
- }
- include fastcgi_params;
- fastcgi_index index.php;
- fastcgi_pass unix:/tmp/php-fm.sock;
- fastcgi_param SCRIPT_FILENAME /usr/local/www/nginx/index.php;
- fastcgi_param SCRIPT_NAME $fastcgi_script_name;
- fastcgi_param PATH_INFO $path_info;
- }
- # Below is for the Expression Engine Control Panel
- location /system/ {
- if (-f $request_filename) {
- expires max;
- break;
- }
- if (!-e $request_filename) {
- rewrite ^/system/(.*)$ /system/index.php/$1 last;
- }
- }
- location /system/index.php {
- fastcgi_pass unix:/tmp/php-fm.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- # Below is a working Codeigniter section
- location /cheatsheets/ {
- if (-f $request_filename) {
- expires max;
- break;
- }
- if (!-e $request_filename) {
- rewrite ^/cheatsheets/(.*)$ /cheatsheets/index.php/$1 last;
- }
- }
- location = /notfound.html {
- root /usr/local/www/nginx;
- }
- location /cheatsheets/index.php {
- fastcgi_pass unix:/tmp/php-fm.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- # This is to cover things like phpinfo.php in root
- location ~ \.php$ {
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
- include fastcgi_params;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_pass unix:/tmp/php-fm.sock;
- }
- # Below ends server section near beginning
- }
- # Below ends http section at beginning
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement