桓臺網(wǎng)站開發(fā)廣州:推動優(yōu)化防控措施落地
因?yàn)镹PS默認(rèn)也支持http的訪問,所以在部署完后就一直沒在意這個(gè)事情。
因?yàn)榉?wù)器是暴露在公網(wǎng)內(nèi)的,所以還是要安全一點(diǎn)才行。不然一旦遠(yuǎn)控的機(jī)器被破解了就很危險(xiǎn)了
一、使用nginx反向代理訪問
1、首先在nps的配置文件里關(guān)閉使用https選項(xiàng),同時(shí)修改端口為只允許本機(jī)連接
配置文件位于 /etc/nps/conf/nps.conf
#HTTP(S) proxy port, no startup if empty
http_proxy_ip=127.0.0.1 #注意修改
http_proxy_port=34565
https_proxy_port=34566
https_just_proxy=false
#default https certificate setting
#https_default_cert_file=conf/qingtongqing.cc_bundle.pem
#https_default_key_file=conf/qingtongqing.cc.key#web
web_host=a.o.com
web_username=admin
web_password=xxxxxx
web_port = 34567
web_ip=127.0.0.1 #注意修改
web_base_url=
web_open_ssl=false
web_cert_file=conf/qingtongqing.cc_bundle.pem
web_key_file=conf/qingtongqing.cc.key
2、在nginx的配置文件下添加有關(guān)nps的配置文件,不建議直接修改nginx配置
在路徑/etc/nginx/conf.d
下添加 nps.conf
配置文件
server {listen 3456 ssl;server_name www.qingtongqing.cc; # 替換成你的NPS域名ssl_protocols TLSv1.2; # 使用與NPS相同的SSL/TLS版本ssl_ciphers 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384';ssl_certificate /ssl/qingtongqing.cc_nginx/qingtongqing.cc_bundle.crt; # 替換成你的SSL證書文件路徑ssl_certificate_key /ssl/qingtongqing.cc_nginx/qingtongqing.cc.key; # 替換成>你的SSL私鑰文件路徑location / {proxy_pass https://127.0.0.1:34567; # 替換成你NPS服務(wù)的實(shí)際IP地址和端口號proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Proto $scheme;}
}
配置文件做完后要等待一段時(shí)間,記得重啟nps客戶端和nginx程序
二、直接配置文件修改使用https
nps的配置文件里打開使用https選項(xiàng),同時(shí)修改端口為允許所有客戶端連接
配置文件位于 /etc/nps/conf/nps.conf
#HTTP(S) proxy port, no startup if empty
http_proxy_ip=0.0.0.0
http_proxy_port=34565
https_proxy_port=34566
https_just_proxy=false
#default https certificate setting
#https_default_cert_file=conf/qingtongqing.cc_bundle.pem
#https_default_key_file=conf/qingtongqing.cc.key#web
web_host=a.o.com
web_username=admin
web_password=xxxxxx
web_port = 34567
web_ip=0.0.0.0
web_base_url=
web_open_ssl=true
web_cert_file=/ssl/qingtongqing.cc_nginx/qingtongqing.cc_bundle.crt #注意修改文件路徑
web_key_file=/ssl/qingtongqing.cc_nginx/qingtongqing.cc.key #注意修改文件路徑
三、重啟驗(yàn)證
在這里還是推薦使用nginx反向代理的方法去做,NPS畢竟是非商業(yè)化的開源軟件,開放端口暴露在公網(wǎng)上有一定的風(fēng)險(xiǎn)存在。