2

I am trying to run apache and nginx together. I want that apache should listen to port 8080 and nginx should listen to 80. For that, I have modified the ports.conf to Listen to 8080 and also modified the virtual host configuration. After restart, the server starts without any error but I am unable to access the url.

/etc/apache2/sites-avaialbled/mysite

<VirtualHost *:8080>
  ServerName myproject
  ServerAdmin [email protected]

  DocumentRoot /var/www
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>
  <Directory /trac>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
  </Directory>

  ErrorLog /var/log/apache2/error.log
  LogLevel warn
  CustomLog /var/log/apache2/access.log combined
  ServerSignature On

<Location /svn>
   DAV svn
   SVNParentPath /svn

   AuthType Basic
   AuthName "Subversion Repository"
   AuthUserFile /etc/svnauth
   Require valid-user
   AuthzSVNAccessFile /etc/svnaccess
</Location>

<Location /trac>
   SetHandler mod_python
   PythonHandler trac.web.modpython_frontend
   PythonOption TracEnvParentDir /trac
   PythonOption TracUriRoot /trac

   AuthType Basic
   AuthName "Trac"
   AuthUserFile /etc/svnauth
   Require valid-user
</Location>

</VirtualHost>

/etc/apache2/ports.conf

NameVirtualHost *:8080
Listen 8080

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

Do I need to change something else here?

2

5 Answers 5

5

Verify that there are no other Listen directives anywhere: grep -ri listen /etc/apache/*

Also show what netstat says apache IS listening on: netstat -plnt | grep http

Replace httpd with the name of the apache binary on your system

1
  • Replacing httpd did work
    – gentrobot
    Oct 20, 2012 at 11:11
1

Did you try to access the url with the port behind? ....com:8080 ?

My guess is that you intended to configure nginx to be running as a reverce proxy, but you do not proxy the traffic you want to port 8080.

Can you please post your nginx config, too?

1

For anyone repeatedly reading posts like these, then head-slapping when it doesn't work, the older posts refer to older versions of Apache.

The file you probably need to edit to change the port is: /etc/apache2/apache2.conf

Thanks to someone who posted a version of this, which let me identify my own problem:

grep -ri listen /etc/apache2/*
0

Make sure that nginx is not listening on 443. Or remove the Listen 443 from apache configuration.

0

Apache under debian and Ubuntu uses a seperate file

as already posted under

How to choose which IP apache2 uses globally

You can see that there is a ports.conf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .