diff --git a/build/debbuild/22.04/DEBIAN/postinst b/build/debbuild/22.04/DEBIAN/postinst index dc9ee17..d145544 100644 --- a/build/debbuild/22.04/DEBIAN/postinst +++ b/build/debbuild/22.04/DEBIAN/postinst @@ -11,7 +11,6 @@ OmcDaemon=omcd NginxEtcDir=/etc/nginx NginxConfDir=${NginxEtcDir}/conf.d CFileList="omc.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml" -LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png" echo "" echo "* To start/stop/restart/status omc service, please run:" @@ -55,12 +54,7 @@ else fi if [ ! -e "${FERootDir}/config.js" ]; then cp ${FERootDir}/default/config.js ${FERootDir}; -fi -for LogoFile in ${LogoFileList}; do - if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then - cp ${OMCStaticDir}/agt.d/logo/${LogoFile} ${OMCStaticDir}/logo; - fi -done +fi if ! id -u omc >/dev/null 2>&1 ; then useradd -d /opt/omc -m -s /bin/bash -pomc123 omc; mkdir -p /opt/omc/ftp diff --git a/build/debbuild/22.04/etc/nginx/conf.d/omc.conf b/build/debbuild/22.04/etc/nginx/conf.d/omc.conf index 5eebc39..88ab5dc 100644 --- a/build/debbuild/22.04/etc/nginx/conf.d/omc.conf +++ b/build/debbuild/22.04/etc/nginx/conf.d/omc.conf @@ -1,51 +1,31 @@ server { - listen 4443 ssl; - listen [::]:4443 ssl; - server_name 0.0.0.0; - root /usr/local/omc/htdocs/front/; - index index.html index.htm; - server_name localhost; - # SSL - ssl_certificate /usr/local/omc/etc/certs/ca_cert.pem; - ssl_certificate_key /usr/local/omc/etc/certs/private_key.pem; - #ssl_certificate /usr/local/omc/etc/certs/tsa-omc.pem; - #ssl_certificate_key /usr/local/omc/etc/certs/tsa-omc_pri.pem; - -# location /api/rest/securityManagement { -# proxy_pass http://127.0.0.1:5050; -# } -# location /api/rest/resourceManagement { -# proxy_pass http://127.0.0.1:5050; -# } -# location /api/rest/performanceManagement { -# proxy_pass http://127.0.0.1:5050; -# } -# location /api/rest/faultManagement { -# proxy_pass http://127.0.0.1:5050; -# } -# location /api/rest/aaaa/ { -# proxy_pass http://127.0.0.1:4040; -# } - location /api/rest/ { - proxy_pass http://127.0.0.1:3030; - } + listen 33080; + listen [::]:33080; + server_name localhost; + + #access_log /var/log/nginx/host.access.log main; + + # ssl_certificate /usr/share/nginx/cert/www.x.cn_chain.crt; + # ssl_certificate_key /usr/share/nginx/cert/www.x.cn.key; + + # ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; + # ssl_session_timeout 5m; + # ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5; + # ssl_prefer_server_ciphers on; + # ssl_dhparam /usr/share/nginx/cert/dhparams.pem; + + # OMC location / { - try_files $uri $uri/ =404; + root /usr/local/omc/htdocs/front; + + try_files $uri $uri/ /index.html; + index index.html index.htm; } -} -server { - listen 8888 default_server; - listen [::]:8888 default_server; - root /usr/local/omc/htdocs/front/; - index index.html index.htm; - server_name localhost; - location /omc-api/ { - proxy_pass http://127.0.0.1:3030/; + proxy_pass http://127.0.0.1:33030/; - proxy_http_version 1.1; - proxy_cache_bypass $http_upgrade; + proxy_cache_bypass $http_upgrade; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; @@ -56,11 +36,29 @@ server { proxy_set_header X-Forwarded-Port $server_port; } - location / { - root /usr/local/omc/htdocs/front; + location /api/rest/ { + # 添加斜杠并重定向 + #rewrite ^([^.]*[^/])$ $1/ permanent; + proxy_pass http://127.0.0.1:33030/nms-cxy/api/rest/; - try_files $uri $uri/ /index.html; - index index.html index.htm; + proxy_cache_bypass $http_upgrade; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + 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; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; } } diff --git a/build/debbuild/DEBIAN/postinst b/build/debbuild/DEBIAN/postinst index 08dfc92..84275e7 100644 --- a/build/debbuild/DEBIAN/postinst +++ b/build/debbuild/DEBIAN/postinst @@ -11,7 +11,6 @@ OmcDaemon=omcd NginxEtcDir=/etc/nginx NginxConfDir=${NginxEtcDir}/conf.d CFileList="omc.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml" -LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png" echo "" echo "* To start/stop/restart/status omc service, please run:" @@ -55,12 +54,7 @@ else fi if [ ! -e "${FERootDir}/config.js" ]; then cp ${FERootDir}/default/config.js ${FERootDir}; -fi -for LogoFile in ${LogoFileList}; do - if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then - cp ${OMCStaticDir}/agt.d/logo/${LogoFile} ${OMCStaticDir}/logo; - fi -done +fi if ! id -u omc >/dev/null 2>&1 ; then useradd -d /opt/omc -m -s /bin/bash -pomc123 omc; mkdir -p /opt/omc/ftp diff --git a/build/rpmbuild/BUILD/etc/nginx/conf.d/omc.conf b/build/rpmbuild/BUILD/etc/nginx/conf.d/omc.conf index 5eebc39..88ab5dc 100644 --- a/build/rpmbuild/BUILD/etc/nginx/conf.d/omc.conf +++ b/build/rpmbuild/BUILD/etc/nginx/conf.d/omc.conf @@ -1,51 +1,31 @@ server { - listen 4443 ssl; - listen [::]:4443 ssl; - server_name 0.0.0.0; - root /usr/local/omc/htdocs/front/; - index index.html index.htm; - server_name localhost; - # SSL - ssl_certificate /usr/local/omc/etc/certs/ca_cert.pem; - ssl_certificate_key /usr/local/omc/etc/certs/private_key.pem; - #ssl_certificate /usr/local/omc/etc/certs/tsa-omc.pem; - #ssl_certificate_key /usr/local/omc/etc/certs/tsa-omc_pri.pem; - -# location /api/rest/securityManagement { -# proxy_pass http://127.0.0.1:5050; -# } -# location /api/rest/resourceManagement { -# proxy_pass http://127.0.0.1:5050; -# } -# location /api/rest/performanceManagement { -# proxy_pass http://127.0.0.1:5050; -# } -# location /api/rest/faultManagement { -# proxy_pass http://127.0.0.1:5050; -# } -# location /api/rest/aaaa/ { -# proxy_pass http://127.0.0.1:4040; -# } - location /api/rest/ { - proxy_pass http://127.0.0.1:3030; - } + listen 33080; + listen [::]:33080; + server_name localhost; + + #access_log /var/log/nginx/host.access.log main; + + # ssl_certificate /usr/share/nginx/cert/www.x.cn_chain.crt; + # ssl_certificate_key /usr/share/nginx/cert/www.x.cn.key; + + # ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; + # ssl_session_timeout 5m; + # ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5; + # ssl_prefer_server_ciphers on; + # ssl_dhparam /usr/share/nginx/cert/dhparams.pem; + + # OMC location / { - try_files $uri $uri/ =404; + root /usr/local/omc/htdocs/front; + + try_files $uri $uri/ /index.html; + index index.html index.htm; } -} -server { - listen 8888 default_server; - listen [::]:8888 default_server; - root /usr/local/omc/htdocs/front/; - index index.html index.htm; - server_name localhost; - location /omc-api/ { - proxy_pass http://127.0.0.1:3030/; + proxy_pass http://127.0.0.1:33030/; - proxy_http_version 1.1; - proxy_cache_bypass $http_upgrade; + proxy_cache_bypass $http_upgrade; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; @@ -56,11 +36,29 @@ server { proxy_set_header X-Forwarded-Port $server_port; } - location / { - root /usr/local/omc/htdocs/front; + location /api/rest/ { + # 添加斜杠并重定向 + #rewrite ^([^.]*[^/])$ $1/ permanent; + proxy_pass http://127.0.0.1:33030/nms-cxy/api/rest/; - try_files $uri $uri/ /index.html; - index index.html index.htm; + proxy_cache_bypass $http_upgrade; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + 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; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; } } diff --git a/build/rpmbuild/SPECS/omc.spec b/build/rpmbuild/SPECS/omc.spec index 02889ef..4f149c6 100644 --- a/build/rpmbuild/SPECS/omc.spec +++ b/build/rpmbuild/SPECS/omc.spec @@ -73,7 +73,6 @@ UsrLocalBinDir=/usr/local/bin OmcDaemon=omcd NginxEtcDir=/etc/nginx CFileList="omc.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml" -LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png" for CFile in ${CFileList}; do if [ ! -e "${OMCEtcDir}/${CFile}" ]; then cp ${OMCEtcDir}/default/${CFile} ${OMCEtcDir}; @@ -85,11 +84,6 @@ else sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/redis.conf fi if [ ! -e "${FERootDir}/config.js" ]; then cp ${FERootDir}/default/config.js ${FERootDir}; fi -for LogoFile in ${LogoFileList}; do - if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then - cp ${OMCStaticDir}/agt.d/logo/${LogoFile} ${OMCStaticDir}/logo; - fi -done if ! id -u omc >/dev/null 2>&1 ; then useradd -d /opt/omc -m -s /bin/bash -p1000ftp@kp omc; else echo "user omc exist"; fi mkdir -p /opt/omc/ftp mkdir -p /opt/omc/ftp/log