时隔两年,不怕麻烦,正是启用了畅捷通nginx的ssl加密https访问!
畅捷通的配置文件有许多,其中很多是垃圾文件,所以其实配置这东西没什么难的,难在别在错误的地方改。
畅捷通的网页服务器程序在\Chanjet\TPlusStd\WebServer\
其中server是iis服务器,但配置文件也在这个目录下,所以修改所有配置都要在这个地方。
nginx目录就是nginx服务器了,一般我们用这个,占用少速度快。
开启的文件在安装盘位置的\Chanjet\TPlusStd\WebServer\server目录下。
编辑\Chanjet\TPlusStd\WebServer\server目录目录下的nginx.config
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
include ../nginx/conf/mime.types;
default_type application/octet-stream;
# ??????????????????????????csv?????????????????????????????????????????????? ???? 2016-08-17
#remote_addr,remote_user,time_local,request,status,body_bytes_sent,http_referer,http_user_agent,http_x_forwarded_for,upstream_addr,upstream_status,request_time,upstream_response_time
log_format main '$remote_addr,$remote_user,$time_local,"$request", '
'$status,$body_bytes_sent,"$http_referer",'
'"$http_user_agent","$http_x_forwarded_for",'
'"$upstream_addr","$upstream_status","$request_time","$upstream_response_time" ';
sendfile on;
keepalive_timeout 600s;
client_max_body_size 2000m;
send_timeout 6000s;
fastcgi_connect_timeout 600;
fastcgi_read_timeout 6000;
fastcgi_send_timeout 6000;
gzip on;
gzip_static on;
gzip_proxied any;
gzip_min_length 1024;
gzip_buffers 4 16k;
gzip_comp_level 3;
gzip_types text/htm text/plain text/css application/x-javascript application/xml;
gzip_vary on;
include proxy.config;
server {
listen 80;
server_name localhost;
## ??? HTTP ?????????????????? HTTPS
return 301 https://$host$request_uri;
}
server {
#???80???443???????????????????????????400??????
#listen 80;
listen 443 ssl;
#ssl on;
ssl_certificate server.pem;
ssl_certificate_key server.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
ssl_prefer_server_ciphers on;
#server_name localhost;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
charset utf-8;
# nginx??????
location /tplus/touch/ {
root html;
index index.html;
# url ?????????????????????index.html
try_files $uri /tplus/touch/index.html;
}
# nginx??????
location / {
root html;
index index.html;
# url ?????????????????????index.html
try_files $uri /index.html;
}
access_log logs/host.access.log main;
set $is_matched 0;
if ( $uri ~* "\.svg$" )
{
set $is_matched 1;
}
if ( $uri ~* "\.ttf$" )
{
set $is_matched 1;
}
if ( $uri ~* "\.eot$" )
{
set $is_matched 1;
}
if ( $uri ~* "\.woff$" )
{
set $is_matched 1;
}
if ( $uri ~* "\.woff2$" )
{
set $is_matched 1;
}
#if ( $uri !~ ^/(.*)\(.svg)$ )
#{
if ($is_matched = 0) {
rewrite ^/(.*)/v2/dist/(.*)$ /$1/v2/dist/$2 break;
rewrite ^/(.*)/v2 /$1/v2/index.html break;
}
#}
if ( $uri ~* "\.dll$" )
{
return 404;
}
rewrite ^/([0-9a-zA-Z]+)/(.*)\.(gif|jpg|jpeg|png|css|js|ico|htm|html|xml|zip|svg|ttf|eot|woff|woff2)$ /_html/$2.$3 last;
rewrite ^/favicon.ico /_html/favicon.ico last;
rewrite ^/([0-9a-zA-Z]+)$ /301.html last;
location ~ .*\.config {
return 404;
}
location /_html {
location ~ .*\.config
{
return 404;
}
alias ../../website;
#expires 30d; #?????????????????????????????????????????????????????????????????????????????????
}
location /_lgs {
alias ../../appserver/logs;
}
location ~* .*\.bash_history$ {
return 404;
}
rewrite ^/(.*)/ScriptResource.axd /html last;
#??????
rewrite ^/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)/$ /$1/tenant.html last;
rewrite ^/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ /$1/tenant.html last;
#locations
include *.conf;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root ../nginx/html;
}
location = /301.html {
root ../nginx/html;
}
}
}以上是完整的配置文件。
其中修改的地方是:
1、分开80和443 的处理,防止出现400错误。
2、设置TLS为1.2和1.3,畅捷通原本的会导致浏览器报错,因为畅捷通团队使用的是过时的加密措施,现在主流浏览器已经不被支持。
证书的位置在\Chanjet\TPlusStd\WebServer\server目录下。
申请证书后把证书中的pem和key复制到server文件夹下,并删除原有,改名为server.pem和server.key
但是可以看得出畅捷通团队比较拉跨,配置文件好几个,丢的哪都是。
此外我还发现在有这种错误:
2024/11/28 00:29:38 [warn] 5160#364: duplicate extension "js", content type: "application/x-javascript", previous content type: "application/javascript" in D:\Chanjet\TPlusStd\WebServer\server\../nginx/conf/mime.types:9
2024/11/28 00:29:38 [warn] 5160#364: duplicate extension "svg", content type: "image/svg+xml", previous content type: "image/svg+xml" in D:\Chanjet\TPlusStd\WebServer\server\../nginx/conf/mime.types:27
这是因为在:\Chanjet\TPlusStd\WebServer\nginx\conf\mime.types中存在重复定义的情况,找到相同的内容删除就可以了。
如:
application/msword doc;
……………………
application/msword doc;
删除一个。