Run AMP over subdomain and https certificate from Plesk

OS Name/Version: Debian GNU/Linux 10 (buster)

Product Name/Version: AMP Release “Halimede” - v2.4.0.10, built 27/10/2022 18:15

Problem Description:

Good day,
I installed your software on my server today.
But first of all without the NGINX or the https setting, since I run my dedicated server via the Plesk system.
Now I wanted to ask - before I buy a license - whether it is possible to install (or set up) the AMP in such a way that I create a subdomain in Plesk and the system can be reached via it?
I don’t care if the webroot files remain in /home/amp/. It would only be important to me that I can use my subdomain via Plesk, because my https certificates also run over it.

Thank you for your replies and have a nice day.

I haven’t used it myself but others seem to have had success running Plesk with their nginx and then AMP as a subdomain.

Cool thanks for your answer.
But… uhm, is there a way to “automatically” configure AMP for this usecase or should i do it myself?
Because AMPs service will start after every update and i think it will reconfigure AMP to default settings i guess?

You would manually configure AMP using the install script. Then edit the nginx config file to include AMP. I don’t know how Plesk manages that config file so unsure what it would take to make the settings “stick”.

2 Likes

I don’t know much about Plesk but it looks like it uses Apache for the frontend (webservers) and nginx for the backend (reverse proxy). Seems to assume that each use case will use both. Not clear whether it will allow just an nginx config alone to proxy AMP’s webserver. If it allows a manual nginx config to be added but still handles the certs, then it could work (the wiki article has the sample nginx server block to include for AMP).

Yeah, I should clarify in my response you would manually configure AMP and select “No” when asked to setup HTTPS in the install script.

I use the same Setup.
For anyone that wants to do the same:

Set Up AMP with install manager → Everything NO

When AMP is running, create a subdomain in plesk (optional)
In Plesk go to you (Sub-)Domain, select Hosting and DNS, then Apache and nginx
Scroll down to “additional nginx config” (or similar; last field on the page)
paste this:

location ~ / {
	proxy_pass http://IPADDR:8080;  # Or whatever local IP and port ADS is listening on
	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        Upgrade $http_upgrade;
	proxy_set_header        Connection "Upgrade";
	proxy_set_header        X-AMP-Scheme $scheme;
	proxy_read_timeout      86400s;
	proxy_send_timeout      86400s;
	proxy_http_version      1.1;
	proxy_redirect          off;
	proxy_buffering         off;
	client_max_body_size    10240M;

	# The following nine lines will only work if nginx and AMP are on the same host
	error_page 502 /NotRunning.html;
	location = /NotRunning.html {
		root /opt/cubecoders/amp/shared/WebRoot;
		internal;
	}

	location /shared/ {
		alias /opt/cubecoders/amp/shared/WebRoot/;
	}
}

Click apply.
Set “Use reverse proxy” in AMP config page (also worked without that for me)

DONE
Certificate via Plesk Plugin Lets Encrypt works fine!
Docker Instances on existing Docker installation also works! (needed to add user amp to docker group)

You wouldn’t have to say no to all the install steps, just the HTTPS portion (as mentioned in the post right above yours).
There’s an existing HTTPS guide here:
https://discourse.cubecoders.com/t/setting-up-secure-http-https-with-amp/2305