Nginx / Apache Virtual Host using Docker port

Questions about HTTP Access/Mods may go here
Forum rules
Synology Community is the new platform for the enthusiasts' interaction, and it will soon be available to replace the Forum.
linvi
I'm New!
I'm New!
Posts: 2
Joined: Sun Sep 09, 2018 7:46 pm

Nginx / Apache Virtual Host using Docker port

Unread post by linvi » Sun Sep 09, 2018 8:00 pm

Hello,

I have multiple websites running on different docker containers.
Each of the containers are mapped to a different port on the server (e.g 8080, 8081...).

I want to the requests sent to a specific route to be using as a reverse proxy the content returned by the website on the container.

For example :

Calling externally : https://user.synology.me/website1 -> uses result from calling http://localhost:8080
Calling externally : https://user.synology.me/website2 -> uses result from calling http://localhost:8081

To do so, I created a new file /usr/local/etc/apache24/sites-enabled/docker.conf

Code: Select all

<VirtualHost *:80 *:443>
    ServerName user.synology.me
    SetEnv HOST user.synology.me

    ProxyVia On
    ProxyRequests Off

    ProxyPass /website1 http://localhost:8080
    ProxyPassReverse /website1 http://localhost:8080

</VirtualHost>
Now I have 2 questions :

* How to restart apache and have the new configuration being applied.
* What is wrong with this configuration? When I go on http(s)://user.synology.me/cloud I receive a 500 error code.

Thanks,
Linvi

User avatar
Rusty1281
Sagacious
Sagacious
Posts: 3232
Joined: Fri Jun 03, 2011 10:51 pm

Re: Nginx / Apache Virtual Host using Docker port

Unread post by Rusty1281 » Mon Sep 10, 2018 5:20 am

Any reason you are not using the built in reverse proxy for this? Control panel > application portal?
Synology DS918+ (4x4TB WD RED - RAID 5 with 2x250GB 960EVO NVMe) | Synology DS412+ (4x3TB WD RED - RAID 5) | RT1900AC

linvi
I'm New!
I'm New!
Posts: 2
Joined: Sun Sep 09, 2018 7:46 pm

Re: Nginx / Apache Virtual Host using Docker port

Unread post by linvi » Mon Sep 10, 2018 8:09 am

Hello,

Because the built in reverse proxy does not allow you to use the port 80 or 443.
I assume this could be done with configuration files but I did not manage to make it work either with the it.

In addition when I modified manually the nginx reverse proxy via a custom script in /usr/local/etc/nginx/sites-enabled, I started to receive some notifications from DSM stating :
Warning: DSM could not start normally, please contact the synology support.
I reverted the changes and the warning went away.

Here is what I had :

Code: Select all

server {
	listen 80;
	user.synology.me;

	location /website1/ {
		proxy_pass http://localhost:8080
	}
}

Post Reply

Return to “HTTP/Apache Mods”