Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sub Domain with different ports in Plesk

I am new to Plesk ( and virtual servers in general ). I have a server running CentOS and Plesk 12 and my domain and web site are working perfectly. At present I also have an instance of Dreamfactory running on port 82 (so access it at http://example.com:81 ) but I wondered if it were possible to setup a subdomain with plesk such as http://api.example.com that would load my dream factory instance without forwarding to http://example.com:81 (effectively masking the port number).

like image 664
Gavin Beard Avatar asked May 16 '16 07:05

Gavin Beard


1 Answers

Open sub-domain's "Apache & nginx Settings" and add into "Additional directives for HTTP":

# for Apache
ProxyPass / http://example.com:81/

Or

# for Nginx
location ~ / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://example.com:81;
}

plesk sub domain different port

Like this for Apache: plesk sub domain different port

Or like this for nginx: plesk sub domain different port

like image 67
Oleg Neumyvakin Avatar answered Oct 15 '22 17:10

Oleg Neumyvakin