Nginx dev config

server {
listen 192.0.2.1:80;
server_name "~^(dev\d{1,3}+)\.example\.com$";

return 301 https://$host$request_uri;
}

server {
listen 192.0.2.1:443 ssl;
server_name "~^(dev\d{1,3}+)\.example\.com$";

ssl on;
ssl_certificate /etc/nginx/ssl/wcard.example.com.crt;
ssl_certificate_key /etc/nginx/ssl/wcard.example.com.key;

location ^~ / {
proxy_pass http://127.0.0.1/;
proxy_set_header Host $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 $scheme;
}

location /images/ {
proxy_intercept_errors on;
error_page 404 = @prod;
proxy_pass http://127.0.0.1;
proxy_set_header Host $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 $scheme;
}

location @prod {
proxy_pass https://www.example.com;
proxy_set_header Host www.example.com;
}

}

Запись опубликована в рубрике Stuff. Добавьте в закладки постоянную ссылку.