Article ID: 114249, created on Jun 29, 2012, last review on Apr 2, 2015

  • Applies to:
  • Plesk 12.0 for Linux
  • Plesk 11.0 for Linux
  • Plesk 11.5 for Linux


How to change ports of Apache running behind Nginx?


As of the release of Plesk version 11.0, Nginx can be installed as a reverse proxy server in front of Apache. The Nginx process runs on ports 80 and 443. It accepts all HTTP(s) requests and forwards them to Apache, which runs on ports 7080 and 7081. Check the Administrator's Guide for more details about Nginx.

# netstat -ntpl |grep httpd
tcp        0      0 :::7080     :::*     LISTEN      31773/httpd
tcp        0      0 :::7081     :::*     LISTEN      31773/httpd

Use the instructions below to change the default Apache ports 7080/7081 to others (for example, to ports 8080/8081).

  1. If you want to change the default ports to 8080/8081, change port listening in the Apache configuration files as follows:

    • Replace Listen 7080 with Listen 8080 in the /etc/httpd/conf/httpd.conf file.
    • Replace Listen 7081 with Listen 8081 in the /etc/httpd/conf.d/ssl.conf file.
  2. Set new port values for the custom domain templates:

    • To change the Apache HTTP port: Find all occurrences of the string $VAR->server->webserver->httpPort and replace them with the new port number enclosed in quotation marks (e.g., "8080").

    • To change the Apache HTTPS port: Find all occurrences of the string $VAR->server->webserver->httpsPort and replace them with the new port number enclosed in quotation marks (e.g., "8081").

    Do not change the default templates. To introduce your changes to the configuration, copy the templates you need to the /usr/local/psa/admin/conf/templates/custom/ directory and modify them, preserving the directory structure. Then modify these copies. You can create new templates from scratch and place them in the custom/ directory according to the default structure.

    You can use the sed utility for quick replacement:

    # cd /usr/local/psa/admin/conf/templates
    cp -a default custom
    cd custom
    find . -type f | xargs sed -r -i~ 's/\{?\$VAR->server->webserver->httpPort\}?/8080/g'
    find . -type f | xargs sed -r -i~ 's/\{?\$VAR->server->webserver->httpsPort\}?/8081/g'
  3. Update the domain configuration:

    /usr/local/psa/admin/sbin/httpdmng --reconfigure-all
  4. Restart the Apache and Nginx services:

    # /etc/init.d/httpd restart
    # /etc/init.d/nginx restart
  5. Verify that the changes have been applied:

    # netstat -ntpl |grep httpd
    tcp        0      0 :::8080                     :::*                        LISTEN      8650/httpd
    tcp        0      0 :::8081                     :::*                        LISTEN      8650/httpd

    These instructions are also described in the PP 11 advanced administrator guide.

Search Words


0a53c5a9ca65a74d37ef5c5eaeb55d7f 56797cefb1efc9130f7c48a7d1db0f0c a914db3fdc7a53ddcfd1b2db8f5a1b9c 29d1e90fd304f01e6420fbe60f66f838 01bc4c8cf5b7f01f815a7ada004154a2 aea4cd7bfd353ad7a1341a257ad4724a 2a5151f57629129e26ff206d171fbb5f e335d9adf7edffca6a8af8039031a4c7

Email subscription for changes to this article
Save as PDF