Table of Contents
让Putty保持连接状态
问题:
与服务器建立SSH连接后,如果一定时间内无操作,就会自动断开,需要关掉重开重连,比较麻烦。
解决:
进入Connection主界面下,找到右上角的Seconds between keepalives (0 to turn off),默认为0,表示不发送空包,设定一个正整数(如:30),则每隔一定秒数(如:30秒)会向服务器发送空包,以保持连接状态。
让WinSCP保持连接状态
问题:
与上面的Putty类似,如果一定时间内无操作,WinSCP会断开链接
解决:
在输入相关参数(主机名、端口号……)后,在左下角选择:工具——远项——面板——远程,勾选刷新远程面板间隔,设定时间间隔即可
端口无法连接
问题:
在腾讯云服务器(设公网ip:1.2.3.4)中通过某端口(如:8081)运行某web服务后,在服务器本地正常运行如下。但是,在远程电脑上输入url(1.2.3.4:8081)却无法访问。检查安全组设置,确认8081端口已正常放行。
wget http://localhost:8081/ # return web page normally
解决:
腾讯云的安全组设置只是相当于外置的防火墙,Ubuntu机器本身还自带内部防火墙,有可能处于开启状态并关闭了某些端口,需要检查状态并放行。
sudo apt-get install ufw # insall ufw, must use sudo
sudo ufw status # check status and notice if the port is allowed
sudo ufw allow 8081 # if not allowed, allow it
更改Apache2默认监听端口号
问题:
由于服务器已使用Nginx监听80端口,在又下载了Apache2后使用相关服务会失败。经查,80端口被占用。
service apache2 reload # error: apache2.service is not active, cannot reload
service apache2 status # error: cannot listen to 80 port
解决:
除非关掉Nginx,否则就要改掉Apache2的默认端 口号。主要在两个地方把端口号改掉。
nano /etc/apache2/ports.conf # change "Listen 80" to "Listen 8081"
nano /etc/apache2/sites-enabled/000-default.conf
# change "VirtualHost: *:80" to "VirtualHost: *:8081". Maybe another name for this conf file, depending on the name of your app.
systemctl restart apache2 # restart apache2
netstat -tlpn| grep apache # make sure apache2 is listening to the right port
netstat -antlp | grep 8081 # or, check specific port