How to change/add ports in apache2, in debian?

6,512

I have added 'Listen 8080'

Did you really add a new line to listen on an alternate port, or did you change the existing listen directive?

From a stock lenny configuration file all you should have to do is change these a couple lines. I have a script that changes the stock config to listening port to 8000, and these are the only lines that get changed. After that apache is restarted and you should be done. Verify by running netstat -ntlp and you should see that apache is only listening on the port you set.

apache2/ports.conf

NameVirtualHost *:8000
Listen 8000

apache2/sites-available/default

<VirtualHost *:8000>
Share:
6,512

Related videos on Youtube

Croplio
Author by

Croplio

Updated on September 17, 2022

Comments

  • Croplio
    Croplio over 1 year

    My OS:
    Linux version 2.6.26-2-xen-686 (Debian 2.6.26-25lenny1) ([email protected]) (gcc version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)) #1 SMP Fri Sep 17 00:54:08 UTC 2010

    On my VPS, I need to use both php and ruby. So I want to use apache to handle my php sites and nginx for the ruby sites.
    And pass the php request to apache through Nginx;
    Then, I need to make apache bundle to another port except 80.

    I have added 'Listen 8080' to /etc/ports.conf
    and changed /etc/sites-enabled/000-default ( from [VirtualHost *:80] to [VirtualHost * : *])
    and changed my virtual host ([VirtualHost * . *]);

    Then restarted apache2

    But when I request port 8080, it always direct me to the 80 port; I don't know why.
    ( Apache should not listen to 80 because I will make Nginx to listen to 80);

    Any idea?

  • Croplio
    Croplio over 13 years
    Thanks, I have fix it. The problem lies in my wordpress database and has no relationship with apapche2.