forked from laradock/laradock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Varnish vs Nginx configuration added
- Loading branch information
Anton Sannikov
committed
Oct 31, 2019
1 parent
babfef7
commit 2af7bfa
Showing
9 changed files
with
454 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name www.laravel.test; | ||
rewrite ^(.*) https://laravel.test$1/ permanent; | ||
} | ||
|
||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name laravel.test; | ||
rewrite ^(.*) https://laravel.test$1/ permanent; | ||
} | ||
|
||
server { | ||
listen 443 ssl ; | ||
listen [::]:443 ssl; | ||
ssl_certificate /etc/nginx/ssl/laravel.test.crt; | ||
ssl_certificate_key /etc/nginx/ssl/laravel.test.key; | ||
server_name www.laravel.test; | ||
rewrite ^(.*) https://laravel.test$1/ permanent; | ||
} | ||
|
||
server { | ||
server_name laravel.test; | ||
|
||
# For https | ||
listen 443 ssl ; | ||
listen [::]:443 ssl; | ||
ssl_certificate /etc/nginx/ssl/laravel.test.crt; | ||
ssl_certificate_key /etc/nginx/ssl/laravel.test.key; | ||
|
||
port_in_redirect off; | ||
|
||
add_header Strict-Transport-Security "max-age=31536000"; | ||
add_header X-Content-Type-Options nosniff; | ||
|
||
location / { | ||
proxy_pass http://proxy:6081; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header X-Forwarded-Host $http_host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto https; | ||
proxy_set_header HTTPS "on"; | ||
proxy_redirect off; | ||
} | ||
} | ||
|
||
server { | ||
server_name laravel.test; | ||
|
||
listen 81; | ||
listen [::]:81; | ||
|
||
root /var/www/laravel.test/www; | ||
|
||
index index.php index.html index.htm; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.php$is_args$args; | ||
} | ||
|
||
location ~ \.php$ { | ||
fastcgi_max_temp_file_size 4m; | ||
fastcgi_pass php-upstream; | ||
|
||
# Additional configs | ||
fastcgi_pass_header Set-Cookie; | ||
fastcgi_pass_header Cookie; | ||
fastcgi_ignore_headers Cache-Control Expires Set-Cookie; | ||
try_files $uri /index.php =404; | ||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
fastcgi_param PATH_INFO $fastcgi_path_info; | ||
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; | ||
fastcgi_param HTTPS on; | ||
|
||
fastcgi_buffers 16 16k; | ||
fastcgi_buffer_size 32k; | ||
|
||
fastcgi_intercept_errors on; | ||
|
||
#fixes timeouts | ||
fastcgi_read_timeout 600; | ||
include fastcgi_params; | ||
} | ||
|
||
# Caching | ||
location ~* \.(ico|jpg|webp|jpeg|gif|css|png|js|ico|bmp|zip|woff)$ { | ||
access_log off; | ||
log_not_found off; | ||
add_header Pragma public; | ||
add_header Cache-Control "public"; | ||
expires 14d; | ||
} | ||
|
||
location ~* \.(php|html)$ { | ||
access_log on; | ||
log_not_found on; | ||
add_header Pragma public; | ||
add_header Cache-Control "public"; | ||
expires 14d; | ||
} | ||
|
||
location ~ /\.ht { | ||
deny all; | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,8 @@ | ||
FROM debian:latest | ||
|
||
LABEL maintainer="ZeroC0D3 Team<[email protected]>" | ||
FROM varnish:6.3 | ||
|
||
# Set Environment Variables | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# Install Dependencies | ||
RUN apt-get update && apt-get install -y apt-utils && apt-get upgrade -y | ||
RUN mkdir /home/site && mkdir /home/site/cache | ||
RUN apt-get install -y varnish | ||
RUN rm -rf /var/lib/apt/lists/* | ||
|
||
# Setting Configurations | ||
ENV VARNISH_CONFIG /etc/varnish/default.vcl | ||
ENV CACHE_SIZE 128m | ||
|
This file contains 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
Oops, something went wrong.