Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- user nginx;
- worker_processes 5;
- error_log /var/log/nginx/error.log warn;
- pid /var/run/nginx.pid;
- events {
- worker_connections 1024;
- }
- http {
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
- log_format main '$remote_addr - $remote_user [$time_local] "$request" '
- '$status $body_bytes_sent "$http_referer" '
- '"$http_user_agent" "$http_x_forwarded_for"';
- access_log /var/log/nginx/access.log main;
- sendfile on;
- #tcp_nopush on;
- keepalive_timeout 65;
- gzip on;
- passenger_root /usr/lib/phusion-passenger;
- passenger_ruby /usr/bin/ruby;
- index index.html index.htm index.php;
- server {
- listen 80 default_server;
- server_name _;
- access_log /var/log/nginx/access.log main;
- root /var/www/default;
- }
- include /etc/nginx/conf.d/*.conf; # empty
- include /etc/nginx/sites-enabled/*; # see below for example
- }
- Some of the configs in sites-enabled:
- server {
- listen 80;
- server_name java.test;
- root /var/www/test/java;
- gzip on;
- gzip_proxied any;
- gzip_types text/plain text/css application/javascript application/xml application/json;
- location / {
- proxy_pass http://localhost:8810;
- proxy_set_header X-Real-IP $remote_addr;
- }
- }
- server {
- listen 80;
- server_name test.php;
- rewrite ^ $scheme://www.test.php$request_uri redirect;
- }
- server {
- listen 80;
- server_name www.test.php;
- root /var/www/test/php;
- access_log /var/log/nginx/test.php.access.log;
- error_log /var/log/nginx/test.php.error.log;
- location / {
- try_files $uri $uri/ /index.php?$uri&$args;
- }
- location /system/* {
- return 403;
- }
- # This block will catch static file requests, such as images, css, js
- # The ?: prefix is a 'non-capturing' mark, meaning we do not require
- # the pattern to be captured into $1 which should help improve performance
- location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
- # Some basic cache-control for static files to be sent to the browser
- expires max;
- add_header Pragma public;
- add_header Cache-Control "public, must-revalidate, proxy-revalidate";
- }
- location = /robots.txt { access_log off; log_not_found off; }
- location = /favicon.ico { access_log off; log_not_found off; }
- location ~ /\. { access_log off; log_not_found off; deny all; }
- location ~ ~$ { access_log off; log_not_found off; deny all; }
- location ~ \.php {
- fastcgi_param QUERY_STRING $query_string;
- fastcgi_param REQUEST_METHOD $request_method;
- fastcgi_param CONTENT_TYPE $content_type;
- fastcgi_param CONTENT_LENGTH $content_length;
- fastcgi_param SCRIPT_NAME $fastcgi_script_name;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_param REQUEST_URI $request_uri;
- fastcgi_param DOCUMENT_URI $document_uri;
- fastcgi_param DOCUMENT_ROOT $document_root;
- fastcgi_param SERVER_PROTOCOL $server_protocol;
- fastcgi_param GATEWAY_INTERFACE CGI/1.1;
- fastcgi_param SERVER_SOFTWARE nginx;
- fastcgi_param REMOTE_ADDR $remote_addr;
- fastcgi_param REMOTE_PORT $remote_port;
- fastcgi_param SERVER_ADDR $server_addr;
- fastcgi_param SERVER_PORT $server_port;
- fastcgi_param SERVER_NAME $server_name;
- fastcgi_pass unix:/tmp/php5-fpm.sock;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement