Попытка настроить веб-сервер apache2 для двух разных портов - PullRequest
0 голосов
/ 01 июля 2019

Я настраиваю новый сервер apache2 в экземпляре виртуальной машины Ubuntu 18.04LTS в Google Cloud.Я хочу настроить его для работы на двух разных портах. Он работает правильно на порте 80 ([мой ip]: 80 рендерится правильно), но не может загрузить на [мой ip]: 8087.

При запуске netstat -atn на виртуальной машине:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0    448 10.160.0.3:22           74.125.41.97:42740      ESTABLISHED
tcp        0      0 10.160.0.3:49834        169.254.169.254:80      ESTABLISHED
tcp        0      0 10.160.0.3:49836        169.254.169.254:80      ESTABLISHED
tcp        0      0 10.160.0.3:49832        169.254.169.254:80      ESTABLISHED
tcp        0      0 10.160.0.3:49830        169.254.169.254:80      CLOSE_WAIT 
tcp6       0      0 :::80                   :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 :::8087                 :::*                    LISTEN 

Я также редактировал сети VPC -> Правила брандмауэра:

Name    firewall-8087
Type    Ingress
Targets Apply to all
Filters IP ranges: 0.0.0.0/0
Protocols / port   tcp:8087  udp:8087
Action  Allow
Priority  1000  
Network   default

Мой / etc / apache2 /файл ports.conf:

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80
Listen 8087

<IfModule ssl_module>
        Listen 443
</IfModule>

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

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet 

Мой /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80 *:8087>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet 

Это только два файла, которые я редактировал.

...