Browse Source

Updated nginx config

master
Darks 6 months ago
parent
commit
9fbb14aa37
Signed by: Darks GPG Key ID: F61F10FA138E797C
2 changed files with 25 additions and 32 deletions
  1. +11
    -16
      nginx/sites-available/pc-dev.conf
  2. +14
    -16
      nginx/sites-available/pc.conf

+ 11
- 16
nginx/sites-available/pc-dev.conf View File

@ -1,16 +1,14 @@
server {
set $env pc-dev;
listen [::]:80;
listen *:80;
# server_name dev.planet-casio.com;
server_name v5.planet-casio.com;
include common.conf;
access_log /var/log/nginx/${env}_access.log;
error_log /var/log/nginx/${env}_error.log;
access_log /var/log/nginx/pc-dev_access.log;
error_log /var/log/nginx/pc-dev_error.log;
location / {
return 301 https://$server_name$request_uri;
@ -18,28 +16,26 @@ server {
}
server {
set $env pc-dev;
listen [::]:443 ssl http2;
listen *:443 ssl http2;
# server_name dev.planet-casio.com;
server_name v5.planet-casio.com;
include common.conf;
include ssl.conf;
ssl_certificate /etc/dehydrated/certs/v5.planet-casio.com/fullchain.pem;
ssl_certificate_key /etc/dehydrated/certs/v5.planet-casio.com/privkey.pem;
access_log /var/log/nginx/${env}_access.log;
error_log /var/log/nginx/${env}_error.log;
access_log /var/log/nginx/pc-dev_access.log;
error_log /var/log/nginx/pc-dev_error.log;
root /home/pc-dev/www;
# Serve files from /static as static files
location /static {
alias /home/${env}/www/app/static;
alias /home/pc-dev/www/app/static;
try_files $uri =404;
expires 7d;
add_header Cache-Control "public";
@ -48,8 +44,8 @@ server {
# Serve avatars
location /avatar {
alias /home/${env}/data/avatars;
try_files $uri /default_avatar.png;
root /home/pc-dev/data;
try_files $uri /avatar/default_avatar.png =404;
expires max;
add_header Cache-Control "public";
include gzip.conf;
@ -57,7 +53,7 @@ server {
# Serve files
location /fichiers {
alias /home/${env}/data/fichiers;
alias /home/pc-dev/data/fichiers;
try_files $uri =404;
expires 7d;
add_header Cache-Control "public";
@ -71,7 +67,6 @@ server {
location @application {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi.${env}/socket;
uwsgi_pass unix:/run/uwsgi.pc-dev/socket;
}
}

+ 14
- 16
nginx/sites-available/pc.conf View File

@ -1,16 +1,14 @@
server {
set $env pc;
listen [::]:80;
listen *:80;
# server_name dev.planet-casio.com;
server_name v5.planet-casio.com;
# server_name v5.planet-casio.com;
server_name www.planet-casio.com;
include common.conf;
access_log /var/log/nginx/${env}_access.log;
error_log /var/log/nginx/${env}_error.log;
access_log /var/log/nginx/pc_access.log;
error_log /var/log/nginx/pc_error.log;
location / {
return 301 https://$server_name$request_uri;
@ -23,8 +21,8 @@ server {
listen [::]:443 ssl http2;
listen *:443 ssl http2;
# server_name dev.planet-casio.com;
server_name v5.planet-casio.com;
# server_name v5.planet-casio.com;
server_name www.planet-casio.com;
include common.conf;
include ssl.conf;
@ -32,14 +30,14 @@ server {
ssl_certificate /etc/dehydrated/certs/v5.planet-casio.com/fullchain.pem;
ssl_certificate_key /etc/dehydrated/certs/v5.planet-casio.com/privkey.pem;
access_log /var/log/nginx/${env}_access.log;
error_log /var/log/nginx/${env}_error.log;
access_log /var/log/nginx/pc_access.log;
error_log /var/log/nginx/pc_error.log;
root /home/pc-dev/www;
root /home/pc/www;
# Serve files from /static as static files
location /static {
alias /home/${env}/www/app/static;
alias /home/pc/www/app/static;
try_files $uri =404;
expires 7d;
add_header Cache-Control "public";
@ -48,8 +46,8 @@ server {
# Serve avatars
location /avatar {
alias /home/${env}/data/avatars;
try_files $uri /default_avatar.png;
root /home/pc/data;
try_files $uri /avatar/default_avatar.png =404;
expires max;
add_header Cache-Control "public";
include gzip.conf;
@ -57,7 +55,7 @@ server {
# Serve files
location /fichiers {
alias /home/${env}/data/fichiers;
alias /home/pc/data/fichiers;
try_files $uri =404;
expires 7d;
add_header Cache-Control "public";
@ -71,6 +69,6 @@ server {
location @application {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi.${env}/socket;
uwsgi_pass unix:/run/uwsgi.pc/socket;
}
}

Loading…
Cancel
Save