-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
85 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Nginx configuration example | ||
# @author Amaury Bouchard <[email protected]> | ||
# @copyright © 2024, Amaury Bouchard | ||
# @link https://www.temma.net/documentation/installation#doc-nginx-server | ||
|
||
# http://mysite.com | ||
server { | ||
listen 80; | ||
server_name mysite.com; | ||
return 301 https://www.mysite.com$request_uri; | ||
} | ||
# http://www.mysite.com | ||
server { | ||
listen 80; | ||
server_name www.mysite.com; | ||
|
||
# HTTPS redirection if the SSL certificate exists | ||
if (-f /etc/letsencrypt/live/mysite.com/cert.pem) { | ||
return 301 https://www.mysite.com$request_uri; | ||
} | ||
|
||
# configuration without SSL certificate | ||
root /home/http/mysite.com/www; | ||
index index.php index.html; | ||
# root directory configuration | ||
location / { | ||
try_files $uri $uri/ /index.php/$uri; | ||
} | ||
# PHP handling with PHP-FPM | ||
location ~ \.php$ { | ||
include snippets/fastcgi-php.conf; | ||
# adjust to your PHP version and socket path | ||
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; | ||
} | ||
# logs | ||
error_log /var/log/nginx/www.mysite.com-error.log warn; | ||
access_log /var/log/nginx/www.mysite.com-access.log combined; | ||
} | ||
# https://mysite.com | ||
server { | ||
listen 443 ssl http2; | ||
server_name mysite.com; | ||
|
||
# SSL configuration | ||
ssl_certificate /etc/letsencrypt/live/mysite.com/cert.pem; | ||
ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem; | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
ssl_ciphers HIGH:!aNULL:!MD5; | ||
# redirection | ||
return 301 https://www.mysite.com$request_uri; | ||
} | ||
# https://www.mysite.com | ||
server { | ||
listen 443 ssl; | ||
server_name www.mysite.com; | ||
|
||
root /home/http/mysite.com/www; | ||
index index.php index.html; | ||
|
||
# SSL Configuration | ||
ssl_certificate /etc/letsencrypt/live/mysite.com/cert.pem; | ||
ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem; | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
ssl_ciphers HIGH:!aNULL:!MD5; | ||
# root directory configuration | ||
location / { | ||
try_files $uri $uri/ /index.php/$uri; | ||
} | ||
# PHP handling with PHP-FPM (using UNIX socket or network socket) | ||
location ~ \.php$ { | ||
# UNIX socket configuration (adjust to your PHP version and socket path) | ||
include snippets/fastcgi-php.conf; | ||
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; | ||
# network socket configuration (adjust to your PHP-FPM setup as needed) | ||
#include fastcgi_params; | ||
#fastcgi_pass 127.0.0.1:9000; | ||
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
} | ||
# logs | ||
error_log /var/log/nginx/www.mysite.com-error.log warn; | ||
access_log /var/log/nginx/www.mysite.com-access.log combined; | ||
} | ||
|