Ubuntu 服务器 (apache) 不会响应外部请求
Ubuntu server (apache) won't respond to external requests
我对此很陌生,所以我可能会遗漏一些非常明显的东西,但我无法使用我的外部 IP 连接到我的服务器。在内部,一切都像梦一样 (10.0.0.28/redmine),但是当我尝试使用外部 IP 连接时,请求超时。我转发了我的 ssh 端口和端口 80,如下所示,但这并没有解决问题。
我的端口现在显示为 www.portchecktool.com.
打开
SSH 在内部工作正常,但是当我发出此处显示的命令时,它说连接已被远程主机关闭。
ssh {my external ip} -pxxxx -i /home/millerir/.ssh/id_rsa -l imiller
类似地,当我导航到 {my ip}/redmine 或 {my ip} 或 {my_ip}:80 或我的 ddns 服务地址时,我在尝试从浏览器连接时出现连接重置错误。
我确实检查过服务器正在侦听端口 80 和我的 ssh 端口,如下所示。
me@ubuntu-server:/etc/apache2/sites-available$ sudo netstat -tulpn | grep LISTEN
tcp 0 0 0.0.0.0:xxxx 0.0.0.0:* LISTEN 779/sshd
tcp 0 0 127.0.0.1:57384 0.0.0.0:* LISTEN 1192/redmine
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 862/mysqld
tcp6 0 0 :::xxxx :::* LISTEN 779/sshd
tcp6 0 0 :::80 :::* LISTEN 923/apache2
如果有人能帮助我,我将不胜感激。我被困住了,有点无能为力。
redmine.conf
<VirtualHost *:80>
# 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
DocumentRoot /var/www
<Directory /var/www/redmine>
RailsBaseURI /redmine
PassengerResolveSymLinksInDocumentRoot on
</Directory>
</VirtualHost>
http.conf
<Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
所以我在仔细研究后发现有些路由器不喜欢你去 "out and back in"。我尝试使用我 phone 上的数据连接到我的服务器,现在可以使用了。
我对此很陌生,所以我可能会遗漏一些非常明显的东西,但我无法使用我的外部 IP 连接到我的服务器。在内部,一切都像梦一样 (10.0.0.28/redmine),但是当我尝试使用外部 IP 连接时,请求超时。我转发了我的 ssh 端口和端口 80,如下所示,但这并没有解决问题。 我的端口现在显示为 www.portchecktool.com.
打开SSH 在内部工作正常,但是当我发出此处显示的命令时,它说连接已被远程主机关闭。
ssh {my external ip} -pxxxx -i /home/millerir/.ssh/id_rsa -l imiller
类似地,当我导航到 {my ip}/redmine 或 {my ip} 或 {my_ip}:80 或我的 ddns 服务地址时,我在尝试从浏览器连接时出现连接重置错误。
我确实检查过服务器正在侦听端口 80 和我的 ssh 端口,如下所示。
me@ubuntu-server:/etc/apache2/sites-available$ sudo netstat -tulpn | grep LISTEN
tcp 0 0 0.0.0.0:xxxx 0.0.0.0:* LISTEN 779/sshd
tcp 0 0 127.0.0.1:57384 0.0.0.0:* LISTEN 1192/redmine
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 862/mysqld
tcp6 0 0 :::xxxx :::* LISTEN 779/sshd
tcp6 0 0 :::80 :::* LISTEN 923/apache2
如果有人能帮助我,我将不胜感激。我被困住了,有点无能为力。
redmine.conf
<VirtualHost *:80>
# 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
DocumentRoot /var/www
<Directory /var/www/redmine>
RailsBaseURI /redmine
PassengerResolveSymLinksInDocumentRoot on
</Directory>
</VirtualHost>
http.conf
<Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
所以我在仔细研究后发现有些路由器不喜欢你去 "out and back in"。我尝试使用我 phone 上的数据连接到我的服务器,现在可以使用了。