Created
December 8, 2012 10:06
-
-
Save rubensayshi/4239679 to your computer and use it in GitHub Desktop.
nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 8080; | |
| server_name gw2spidy.rubensayshi.com gw2spidy.com; | |
| rewrite ^(.*) http://www.gw2spidy.com$1 permanent; | |
| } | |
| server { | |
| listen 8080; | |
| server_name www.gw2spidy.com; | |
| set_real_ip_from 127.0.0.1; | |
| real_ip_header CF-Connecting-IP; | |
| access_log /var/log/nginx/gw2spidy.rubensayshi.com.access.log; | |
| error_log /var/log/nginx/gw2spidy.rubensayshi.com.error.log; | |
| client_max_body_size 4M; | |
| client_body_buffer_size 128k; | |
| expires 24h; | |
| root /var/sandbox/gw2spidy/webroot; | |
| location ~ ^/assets/.* { | |
| expires max; | |
| access_log off; | |
| location ~ ^/assets/v[^/]+/.+ { | |
| rewrite ^/assets/v[^/]+/(.+) /assets/$1 break; | |
| } | |
| } | |
| location / { | |
| index index.php; | |
| # if file exists return it right away | |
| if (-f $request_filename) { | |
| break; | |
| } | |
| if (-e $request_filename) { | |
| break; | |
| } | |
| # Useful rewrite for most frameworks, wordpress | |
| if (!-e $request_filename) { | |
| rewrite ^(.+)$ /index.php last; | |
| break; | |
| } | |
| } | |
| location ~ \.php$ { | |
| expires off; | |
| include /etc/nginx/fastcgi_params; | |
| fastcgi_pass php5-fpm-sock; | |
| if ($request_uri ~ ^/api) { | |
| fastcgi_pass php5-fpm-gw2spidy-api-sock; | |
| } | |
| fastcgi_index index.php; | |
| fastcgi_param SCRIPT_FILENAME /var/sandbox/gw2spidy/webroot/$fastcgi_script_name; | |
| break; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| user www-data; | |
| worker_processes 2; # 1 to 4, I normally put this to the number of cores | |
| error_log /var/log/nginx/error.log; | |
| pid /var/run/nginx.pid; | |
| events { | |
| worker_connections 10240; | |
| multi_accept on; # uncomment this line | |
| use epoll; # Add This - We'll want Nginx to use epoll for event timing | |
| } | |
| http { | |
| include /etc/nginx/mime.types; | |
| access_log /var/log/nginx/access.log; | |
| sendfile on; | |
| tcp_nopush on; | |
| keepalive_timeout 0; | |
| tcp_nodelay on; | |
| gzip on; | |
| gzip_disable "MSIE [1-6]\.(?!.*SV1)"; | |
| include /etc/nginx/conf.d/*.conf; | |
| upstream php5-fpm-sock { | |
| server unix:/var/run/php5-fpm.sock; | |
| } | |
| upstream php5-fpm-gw2spidy-api-sock { | |
| server unix:/var/run/php5-fpm-gw2spidy-api.sock; | |
| } | |
| include /etc/nginx/sites-enabled/*; | |
| server { | |
| listen 8080 default_server; | |
| server_name _; | |
| access_log off; | |
| return 404; | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; Start a new pool named 'gw2spidy-api'. | |
| [gw2spidy-api] | |
| listen = /var/run/php5-fpm-gw2spidy-api.sock | |
| user = www-data | |
| group = www-data | |
| pm = ondemand | |
| pm.max_children = 5 | |
| php_admin_value[memory_limit] = 384M | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; Start a new pool named 'www'. | |
| [www] | |
| ; Unix user/group of processes | |
| user = www-data | |
| group = www-data | |
| ; The address on which to accept FastCGI requests. | |
| listen = /var/run/php5-fpm.sock | |
| ; Choose how the process manager will control the number of child processes. | |
| ; Possible Values: | |
| ; static - a fixed number (pm.max_children) of child processes; | |
| ; dynamic - the number of child processes are set dynamically based on the | |
| ; following directives. With this process management, there will be | |
| ; always at least 1 children. | |
| ; pm.max_children - the maximum number of children that can | |
| ; be alive at the same time. | |
| ; pm.start_servers - the number of children created on startup. | |
| ; pm.min_spare_servers - the minimum number of children in 'idle' | |
| ; state (waiting to process). If the number | |
| ; of 'idle' processes is less than this | |
| ; number then some children will be created. | |
| ; pm.max_spare_servers - the maximum number of children in 'idle' | |
| ; state (waiting to process). If the number | |
| ; of 'idle' processes is greater than this | |
| ; number then some children will be killed. | |
| ; ondemand - no children are created at startup. Children will be forked when | |
| ; new requests will connect. The following parameter are used: | |
| ; pm.max_children - the maximum number of children that | |
| ; can be alive at the same time. | |
| ; pm.process_idle_timeout - The number of seconds after which | |
| ; an idle process will be killed. | |
| ; Note: This value is mandatory. | |
| pm = dynamic | |
| ; The number of child processes to be created when pm is set to 'static' and the | |
| ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. | |
| pm.max_children = 20 | |
| ; The number of child processes created on startup. | |
| pm.start_servers = 10 | |
| ; The desired minimum number of idle server processes. | |
| pm.min_spare_servers = 5 | |
| ; The desired maximum number of idle server processes. | |
| pm.max_spare_servers = 10 | |
| ; The number of requests each child process should execute before respawning. | |
| pm.max_requests = 500 | |
| php_admin_value[memory_limit] = 128M |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment