Skip to content

Commit e8a8041

Browse files
committed
Add NginX example configuration.
1 parent b65e2d9 commit e8a8041

2 files changed

Lines changed: 85 additions & 0 deletions

File tree

bin/dpk_pkg-post_script.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ else
4747
pushd /opt/Temma > /dev/null
4848
cp bin/comma /opt/temma-project-web/bin/
4949
cp etc/apache.conf /opt/temma-project-web/etc/
50+
cp etc/nginx.conf /opt/temma-project-web/etc/
5051
cp etc/temma.php /opt/temma-project-web/etc/
5152
cp etc/temma-full.php /opt/temma-project-web/etc/
5253
cp -a etc/asynk /opt/temma-project-web/etc/
@@ -81,6 +82,7 @@ else
8182
pushd /opt/Temma > /dev/null
8283
cp bin/comma /opt/temma-project-api/bin/
8384
cp etc/apache.conf /opt/temma-project-api/etc/
85+
cp etc/nginx.conf /opt/temma-project-api/etc/
8486
cp etc/temma-api.php /opt/temma-project-api/etc/temma.php
8587
cp etc/temma-full.php /opt/temma-project-api/etc/
8688
cp -a etc/asynk /opt/temma-project-api/etc/

etc/nginx.conf

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Nginx configuration example
2+
# @author Amaury Bouchard <amaury@amaury.net>
3+
# @copyright © 2024, Amaury Bouchard
4+
# @link https://www.temma.net/documentation/installation#doc-nginx-server
5+
6+
# http://mysite.com
7+
server {
8+
listen 80;
9+
server_name mysite.com;
10+
return 301 https://www.mysite.com$request_uri;
11+
}
12+
# http://www.mysite.com
13+
server {
14+
listen 80;
15+
server_name www.mysite.com;
16+
17+
# HTTPS redirection if the SSL certificate exists
18+
if (-f /etc/letsencrypt/live/mysite.com/cert.pem) {
19+
return 301 https://www.mysite.com$request_uri;
20+
}
21+
22+
# configuration without SSL certificate
23+
root /home/http/mysite.com/www;
24+
index index.php index.html;
25+
# root directory configuration
26+
location / {
27+
try_files $uri $uri/ /index.php/$uri;
28+
}
29+
# PHP handling with PHP-FPM
30+
location ~ \.php$ {
31+
include snippets/fastcgi-php.conf;
32+
# adjust to your PHP version and socket path
33+
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
34+
}
35+
# logs
36+
error_log /var/log/nginx/www.mysite.com-error.log warn;
37+
access_log /var/log/nginx/www.mysite.com-access.log combined;
38+
}
39+
# https://mysite.com
40+
server {
41+
listen 443 ssl http2;
42+
server_name mysite.com;
43+
44+
# SSL configuration
45+
ssl_certificate /etc/letsencrypt/live/mysite.com/cert.pem;
46+
ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem;
47+
ssl_protocols TLSv1.2 TLSv1.3;
48+
ssl_ciphers HIGH:!aNULL:!MD5;
49+
# redirection
50+
return 301 https://www.mysite.com$request_uri;
51+
}
52+
# https://www.mysite.com
53+
server {
54+
listen 443 ssl;
55+
server_name www.mysite.com;
56+
57+
root /home/http/mysite.com/www;
58+
index index.php index.html;
59+
60+
# SSL Configuration
61+
ssl_certificate /etc/letsencrypt/live/mysite.com/cert.pem;
62+
ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem;
63+
ssl_protocols TLSv1.2 TLSv1.3;
64+
ssl_ciphers HIGH:!aNULL:!MD5;
65+
# root directory configuration
66+
location / {
67+
try_files $uri $uri/ /index.php/$uri;
68+
}
69+
# PHP handling with PHP-FPM (using UNIX socket or network socket)
70+
location ~ \.php$ {
71+
# UNIX socket configuration (adjust to your PHP version and socket path)
72+
include snippets/fastcgi-php.conf;
73+
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
74+
# network socket configuration (adjust to your PHP-FPM setup as needed)
75+
#include fastcgi_params;
76+
#fastcgi_pass 127.0.0.1:9000;
77+
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
78+
}
79+
# logs
80+
error_log /var/log/nginx/www.mysite.com-error.log warn;
81+
access_log /var/log/nginx/www.mysite.com-access.log combined;
82+
}
83+

0 commit comments

Comments
 (0)