diff --git a/core/settings.py b/core/settings.py index 2a8b70e..af962a2 100644 --- a/core/settings.py +++ b/core/settings.py @@ -133,6 +133,7 @@ USE_TZ = True # https://docs.djangoproject.com/en/6.1/howto/static-files/ STATIC_URL = 'static/' +FORCE_SCRIPT_NAME = '/emailservice' MEDIA_URL = 'media/' MEDIA_ROOT = BASE_DIR / 'media' diff --git a/emailservice.service b/emailservice.service index 2de4f6b..57e7c6d 100644 --- a/emailservice.service +++ b/emailservice.service @@ -7,7 +7,7 @@ User=ubuntu WorkingDirectory=/home/ubuntu/emailservice EnvironmentFile=/home/ubuntu/emailservice/.env ExecStart=/home/ubuntu/emailservice/venv/bin/gunicorn core.wsgi:application \ - --bind 0.0.0.0:8081 \ + --bind 0.0.0.0:8091 \ --workers 3 \ --access-logfile /home/ubuntu/emailservice/logs/gunicorn-access.log \ --error-logfile /home/ubuntu/emailservice/logs/gunicorn-error.log \ diff --git a/scratch/nginx_default b/scratch/nginx_default new file mode 100644 index 0000000..94883e8 --- /dev/null +++ b/scratch/nginx_default @@ -0,0 +1,67 @@ +server { + listen 80 default_server; + listen [::]:80 default_server; + server_name _; + return 301 https://$host$request_uri; +} + +server { + listen 443 ssl default_server; + listen [::]:443 ssl default_server; + + server_name _; + + ssl_certificate /etc/nginx/ssl/chained.crt; + ssl_certificate_key /etc/nginx/ssl/private.key; + + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers HIGH:!aNULL:!MD5; + + root /var/www/html; + index index.html index.htm index.nginx-debian.html; + + location /api/v1/customer/ { + proxy_pass http://127.0.0.1:8082/api/v1/customer/; + 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 /emailservice/ { + proxy_pass http://127.0.0.1:8091/; + 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 /crm { + proxy_pass http://127.0.0.1:8081; + 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 /dolibarrbeta { + root /var/www/html; + index index.php; + try_files $uri $uri/ /dolibarrbeta/index.php?$args; + + location ~ \.php$ { + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; + fastcgi_read_timeout 300; + } + } + + location / { + proxy_pass http://127.0.0.1:8080; + 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; + } +}