更改默认apache端口不起作用

gen*_*bot 2 port apache-2.2

我正在尝试同时运行 apache 和 nginx。我希望 apache 应该监听 8080 端口,nginx 应该监听 80。 为此,我修改了 ports.conf 以监听 8080,并且还修改了虚拟主机配置。重新启动后,服务器启动没有任何错误,但我无法访问该网址。

/etc/apache2/sites-avaialbled/mysite

<VirtualHost *:8080>
  ServerName myproject
  ServerAdmin your@email.com

  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>
Run Code Online (Sandbox Code Playgroud)

/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>
Run Code Online (Sandbox Code Playgroud)

我需要在这里更改其他内容吗?

ada*_*ptr 5

验证任何地方都没有其他 Listen 指令:grep -ri listen /etc/apache/*

还显示 netstat 所说的 apache 正在监听的内容:netstat -plnt | grep http

将httpd替换为系统上 apache 二进制文件的名称