No Apache 2.2.22, estou tentando executar dois hosts virtuais com dois IP addys e dois SSL certs. Eu não tenho nada sobre a escuta de portas ou NameVirtualHost em outros arquivos de configuração diferentes dos arquivos que configuram os hosts virtuais. No processo de fazer isso funcionar, eu gostaria de ter a quantidade mínima de código necessária.
No diretório de sites disponíveis, eu tenho o arquivo de configuração site1.com:
NameVirtualHost 1.1.1.1:80
Listen 1.1.1.1:80
Listen 1.1.1.1:443
<VirtualHost 1.1.1.1:80>
ServerAdmin [email protected]
ServerName site1.com
ServerAlias www.site1.com
RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) https://www.site1.com/ [R]
</VirtualHost>
<VirtualHost 1.1.1.1:443>
ServerName site1.com
ServerAlias www.site1.com
DocumentRoot /home/j/site1/public
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/site1.com.crt
SSLCertificateKeyFile /etc/apache2/ssl/site1.com.key
SSLCertificateChainFile /etc/apache2/ssl/gd_bundle_site1.crt
LogLevel warn
ErrorLog /home/j/site1/log/error.log
CustomLog /home/j/site1/log/access.log combined
</VirtualHost>
Se site1.com for o único site ativado, o servidor será iniciado corretamente. Quando eu habilito site2.com eu me deparo com problemas. Sudo apachectl configtest
resulta em Syntax OK
mas uma reinicialização dos resultados do apache em (99)Cannot assign requested address: make_sock: could not bind to address 2.2.2.2:8080 no listening sockets available, shutting down Unable to open logs Action 'start' failed.
Aqui está o conteúdo de site2.com:
NameVirtualHost 2.2.2.2:8080
Listen 2.2.2.2:8080
Listen 2.2.2.2:4430
<VirtualHost 2.2.2.2:8080>
ServerAdmin [email protected]
ServerName site2.com
ServerAlias www.site2.com
RewriteEngine On
RewriteCond %{SERVER_PORT} !4430
RewriteRule (.*) https://www.site2.com/ [R]
</VirtualHost>
<VirtualHost 2.2.2.2:4430>
ServerName site2.com
ServerAlias www.site2.com
DocumentRoot /home/j/site2/public
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/site2.com.crt
SSLCertificateKeyFile /etc/apache2/ssl/site2.key
SSLCertificateChainFile /etc/apache2/ssl/gd_bundle_site2.crt
LogLevel warn
ErrorLog /home/j/site2/log/error.log
CustomLog /home/j/site2/log/access.log combined
</VirtualHost>
Obrigado pela sua ajuda.
ATUALIZAÇÃO:
Resultados para netstat -lpn menos udp6:
(No info could be read for "-p": geteuid()=1000 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
tcp 0 0 1.1.1.1:80 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:7187 0.0.0.0:* LISTEN -
tcp 0 0 1.1.1.1:443 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:55363 0.0.0.0:* LISTEN -
tcp6 0 0 :::7187 :::* LISTEN -
udp 0 0 0.0.0.0:68 0.0.0.0:* -
udp 0 0 1.1.1.1:123 0.0.0.0:* -
udp 0 0 127.0.0.1:123 0.0.0.0:* -
udp 0 0 0.0.0.0:123 0.0.0.0:* -
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 169974 - /tmp/passenger.1.0.32045/generation-0/spawn-server/socket.32055.19978820
unix 2 [ ACC ] STREAM LISTENING 2823 - @/tmp/fam-root-
unix 2 [ ACC ] STREAM LISTENING 180580 - /tmp/passenger.1.0.32045/generation-0/backends/ruby.ui0IFvdXouP5Ukb3zZo2fiLBEJOgc5835cbcGK93fhrs5ogoitaPfi1
unix 2 [ ACC ] STREAM LISTENING 10547 - /var/run/mysqld/mysqld.sock
unix 2 [ ACC ] STREAM LISTENING 106 - @/com/ubuntu/upstart
unix 2 [ ACC ] STREAM LISTENING 182366 - /var/run/apache2/cgisock.32045
unix 2 [ ACC ] STREAM LISTENING 395 - /var/run/dbus/system_bus_socket
unix 2 [ ACC ] SEQPACKET LISTENING 168 - /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 12724 - /var/run/fail2ban/fail2ban.sock
unix 2 [ ACC ] STREAM LISTENING 181619 - /tmp/passenger.1.0.32045/generation-0/socket
unix 2 [ ACC ] STREAM LISTENING 181621 - /tmp/passenger.1.0.32045/generation-0/spawn-server/socket.32053.32793072
unix 2 [ ACC ] STREAM LISTENING 181640 - /tmp/passenger.1.0.32045/generation-0/logging.socket
ATUALIZAÇÃO:
grep -r Listen / etc / apache2 não produz nenhuma referência para escutar na porta 8080 além do que foi mencionado acima.
ATUALIZAÇÃO:
Por sugestão de Jenny D abaixo, ifconfig -a produz o seguinte:
dummy0 Link encap:Ethernet HWaddr be:fc:55:b0:9e:80
BROADCAST NOARP MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth0 Link encap:Ethernet HWaddr f2:3c:91:70:34:84
inet addr:50.116.59.14 Bcast:50.116.59.255 Mask:255.255.255.0
inet6 addr: 2600:3c03::f03c:91ff:fe70:3484/64 Scope:Global
inet6 addr: fe80::f03c:91ff:fe70:3484/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:69078 errors:0 dropped:0 overruns:0 frame:0
TX packets:41852 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16773617 (16.7 MB) TX bytes:69148409 (69.1 MB)
Interrupt:76
gre0 Link encap:UNSPEC HWaddr 00-00-00-00-34-84-00-00-00-00-00-00-00-00-00-00
NOARP MTU:1476 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
ip6gre0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:1448 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
ip6tnl0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:1452 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
ip_vti0 Link encap:IPIP Tunnel HWaddr
NOARP MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:3487 errors:0 dropped:0 overruns:0 frame:0
TX packets:3487 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:62766 (62.7 KB) TX bytes:62766 (62.7 KB)
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
tunl0 Link encap:IPIP Tunnel HWaddr
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)