简体   繁体   中英

How to change nginx port on debian8.3 + plesk 12.5 and set varnish listen on port 80?

Changing the default http port on nginx with Plesk 12.5 is my biggest problem I know how to set up Varnish. I also know to do this on the server with out the Plesk. My OS is Debian 8.3, I wind some instructions for Centos but they were unhelpful to me.

There is two ways

  1. Official with trade-offs:

    customizing Plesk's web server configs templates as described here https://talk.plesk.com/threads/solved-help-required-change-nginx-port.331439/

    You have to starts with creating folder /usr/local/psa/admin/conf/templates/custom and copying following files from /usr/local/psa/admin/conf/templates/default :

     nginx.php nginxDomainForwarding.php nginxDomainForwardingIpDefault.php nginxDomainVhost.php nginxDomainVhostIpDefault.php nginxWebmail.php

    and replace $VAR->server->nginx->httpPort in each file with port number you want.

    Trade-offs are: after upgrade to next version you should perform this procedure again. All changes which will be performed by updates for default templates will be not applies to you.

  2. Fast with unknown side effects: just change ports in table ServiceNodeConfiguration:

    mysql -uadmin -p cat /etc/psa/.psa.shadow -Dpsa -e "select * from ServiceNodeConfiguration where section = 'webProxy'"

     +---------------+----------+-----------------+-------+ | serviceNodeId | section | name | value | +---------------+----------+-----------------+-------+ | 1 | webProxy | enabled | true | | 1 | webProxy | frontendPort | 80 | | 1 | webProxy | sslFrontendPort | 443 | +---------------+----------+-----------------+-------+

And don't forget for /usr/local/psa/admin/bin/httpdmng --reconfigure-all

This is a good command to change port 80 in database for nginx. Varnish now can work through port 80.

mysql -uadmin -p$(cat /etc/psa/.psa.shadow) -Dpsa -e "update ServiceNodeConfiguration set value=8080 where section = 'webProxy' and name ='frontendPort'";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM