Configuration nginx de www

This commit is contained in:
Adrien Bourmault 2021-11-16 19:40:20 +00:00
parent f86cd567de
commit 4aa05cb9b2
1 changed files with 90 additions and 1 deletions

View File

@ -58,3 +58,92 @@ Adresse ipv6 publique : 2001:910:1360::1ca
@localhost admin@a-lec.org
@www.a-lec.org admin@a-lec.org
### Configuration du serveur web (nginx)
server {
set_real_ip_from 192.169.1.1;
real_ip_header proxy_protocol;
# SSL configuration
#
listen 443 ssl proxy_protocol default_server;
listen [::]:443 ssl default_server;
root /var/www/html;
ssl_certificate /etc/letsencrypt/live/www.a-lec.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.a-lec.org/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
# Add index.php to the list if you are using PHP
index index.html index.htm index.php;
server_name www.a-lec.org;
location /.well-known/host-meta {
default_type 'application/xrd+xml';
add_header Access-Control-Allow-Origin '*' always;
}
location /.well-known/host-meta.json {
default_type 'application/jrd+json';
add_header Access-Control-Allow-Origin '*' always;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ $uri.html $uri/index.php?q=$uri&$args =404;
}
ssi on;
ssi_last_modified on;
# pass PHP scripts to FastCGI server
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
# With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 80;
listen [::]:80;
server_name www.a-lec.org;
return 302 https://www.a-lec.org$request_uri;
}
server {
listen 80;
listen [::]:80;
server_name a-lec.org;
return 302 https://www.a-lec.org$request_uri;
}
server {
listen 443 ssl proxy_protocol;
listen [::]:443 ssl;
server_name a-lec.org;
return 302 https://www.a-lec.org$request_uri;
ssl_certificate /etc/letsencrypt/live/a-lec.org-0001/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/a-lec.org-0001/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}