Skip to content

Commit 48248a1

Browse files
committed
Disable ssl in nginx to allow multi hosting at the vps level
1 parent a027a8d commit 48248a1

File tree

5 files changed

+5
-17
lines changed

5 files changed

+5
-17
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,4 @@ This site is deploy to a docker compose setup and can be run in any VPS. There a
4545

4646
## Notes
4747

48-
1. Nginx is one of the services in the docker compose setup and is used as a reverse proxy for nextjs using an encrypted connection. If running in development mode the files `./nginx/fullchain.pem` and `./nginx/privkey.pem` should exist. They can be a self signed certificate. For deployment they should live at `/etc/letsencrypt/live/${DOMAIN}`
49-
2. Payload CMS has the ability to hot reload database changes without having to migrate. In some cases where it can't determine on its own what to do it will prompt the user. Since the promps aren't answerable through docker, in this case the nextjs server should be run locally with `npm run dev` with the environemnt variable `DATABASE_URI="postgres://postgres:<password>@localhost:5432/postgres"` set. This should be the only reason to run the server locally, everything else should be done through docker dev mode.
48+
Payload CMS has the ability to hot reload database changes without having to migrate. In some cases where it can't determine on its own what to do it will prompt the user. Since the promps aren't answerable through docker, in this case the nextjs server should be run locally with `npm run dev` with the environemnt variable `DATABASE_URI="postgres://postgres:<password>@localhost:5432/postgres"` set. This and `npm run payload migrate:create` should be the only reasons to run the server locally, everything else should be done through docker dev mode.

docker-compose.dev.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,3 @@ services:
2727
- action: rebuild
2828
path: ./nginx/templates
2929
target: /etc/nginx/templates/
30-
volumes: !override
31-
- type: bind
32-
source: ./nginx/certificates/
33-
target: /certificates/nginx/

docker-compose.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ services:
77
- images:/app/media
88
environment:
99
- NEXT_PUBLIC_PAYLOAD_URL=https://${DOMAIN:?Website domain required}
10+
- DOMAIN=${DOMAIN?Website domain required}
1011
- SMTP_HOST=${SMTP_HOST:?SMTP_HOST required for email functionality}
1112
- EMAIL_USER=${EMAIL_USER:?EMAIL_USER required for email functionality}
1213
depends_on:
@@ -34,15 +35,9 @@ services:
3435
depends_on:
3536
- payload
3637
ports:
37-
- 443:443
38-
- 80:80
38+
- 127.0.0.1:1000:443
3939
environment:
4040
- NGINX_HOST=${DOMAIN:?Website domain required}
41-
volumes:
42-
- type: bind
43-
source: /etc/letsencrypt/
44-
target: /etc/letsencrypt/
45-
read_only: true
4641
volumes:
4742
pgdata:
4843
images:

next.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const nextConfig = {
1313
output: 'standalone',
1414
experimental: {
1515
serverActions: {
16-
allowedOrigins: ['payload:3000', 'localhost'],
16+
allowedOrigins: ['payload:3000', 'localhost', process.env.DOMAIN],
1717
},
1818
},
1919
}

nginx/templates/servers.conf.template

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
server {
2-
listen 443 ssl;
2+
listen 443;
33
server_name ${NGINX_HOST};
4-
ssl_certificate /etc/letsencrypt/live/${NGINX_HOST}/fullchain.pem;
5-
ssl_certificate_key /etc/letsencrypt/live/${NGINX_HOST}/privkey.pem;
64

75
location / {
86
proxy_pass http://payload:3000;

0 commit comments

Comments
 (0)