Created
January 20, 2015 05:43
-
-
Save mosufy/1127d24ebbb69d41f46f to your computer and use it in GitHub Desktop.
Application Server Block for NGINX LEMP Stack Configuration with SSL
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 80; | |
server_name domain.dev; | |
# force all requests to connec via HTTPS | |
return 301 https://domain.dev$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
server_name domain.dev; | |
access_log /var/log/nginx/app-access.log; | |
error_log /var/log/nginx/app-error.log error; | |
root /var/www/app/public; | |
index index.php index.html index.htm; | |
ssl on; | |
ssl_certificate /etc/nginx/ssl/cert.crt; | |
ssl_certificate_key /etc/nginx/ssl/cert.key; | |
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; | |
ssl_prefer_server_ciphers on; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location = /favicon.ico { log_not_found off; access_log off; } | |
location = /robots.txt { log_not_found off; access_log off; } | |
error_page 404 /index.php; | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment