Open mind-overflow opened 3 years ago
Hmm not sure why the use of Apache in here. Maybe change the env files to run the docker setup not at port 3000 but 80 so that you can acess your remote host directly?
@karolsojko The use of Apache is mandatory, because it is the webserver for that machine. It is handling multiple websites and subdomains, while syncing-server is running in a docker container. So, Apache is running as a reverse proxy, tunneling traffic to the docker container, and thus, running the container directly on port 80/443 is not possible as it would conflict with Apache and block access to all the other services.
In theory, as pointed out by this blog post, making a nginx reverse proxy to syncing-server is straightforward and only requires a few lines of config. This is obviously not the case with Apache, as the standard proxy configuration does not work.
Edit: here's the nginx config, to avoid opening the linked url:
server {
listen 80;
listen [::]:80;
server_name notes.example.org;
location / {
proxy_pass http://127.0.0.1:3000; # syncing-server address
}
}
We have a new documentation suite out. Please give a try and re-check if it helps with your issue: https://docs.standardnotes.org/self-hosting/getting-started/
Context
Hello, I have tried setting up a self-hosted instance of syncing-server. I followed your instructions, which are pretty straightforward:
Since this instance is in a remote server, I have no way to test it by visiting
http://localhost:3000/
. What I did instead, was to create an Apache2 reverse proxy. I tried it both with and without SSL, with no difference. This is the setup:The issue
However, when I try to visit
sync.example.org
, I get a 404 error:If I type
./server.sh logs
, this is what pops up:Temporary fix
I found a temporary fix, that however is not how it's supposed to work. If I modify my Apache configuration and use the docker container's IP instead of
127.0.0.1
, it works.Find the docker container ID
Result:
Find the docker container IP
Result:
So, the IP address is
172.30.0.8
.Point Apache2 to the container IP
Conclusion
By applying the temporary fix, when I visit the page, I get the expected result:
However, the fix is clearly temporary, as the IP docker assigns to its containers is not static. Besides, this is not how it's supposed to work anyway, so I wouldn't feel comfortable leaving it like that anyway.
Any suggestion on how to fix this? If this is not an issue related to syncing-server itself. I'm always available to provide more logs and info if needed. Thanks!
PS:
.env
anddocker-compose.yml
are left untouched.PPS: My server is on Ubuntu Server 20.04, running Apache 2.4.41. Any firewall has been disabled for those tests.