嘟嘟社区

[疑问] 关于哪吒面板,无法载入css、js等文件


大佬们,想搭建个哪吒探针。
环境是:oneinstack 搭建的站,没用宝塔,我看网上的教程全是宝塔。
加了反代和ssl,输入域名https://xxx.com 也能显示哪吒的前台和后台, 但前台和后台的网页中没有加载semantic-ui-alerts.min.css、main.css?v2021111109、main.js?v20211105等文件,导致后台无法添加监控主机,前台无法显示,求大佬指点。

域名的配置文件如下:

  1. server {
  2.         location /
  3.         {
  4.                 proxy_pass http://127.0.0.1:8008;
  5.                 proxy_set_header Host $host;
  6.         }
  7.         location /ws
  8.         {
  9.         proxy_pass http://127.0.0.1:8008;
  10.         proxy_http_version 1.1;
  11.         proxy_set_header Upgrade $http_upgrade;
  12.         proxy_set_header Connection "Upgrade";
  13.         proxy_set_header Host $host;
  14.         }
  15.   listen 80;
  16.   listen [::]:80;
  17.   listen 443 ssl http2;
  18.   listen [::]:443 ssl http2;
  19.   ssl_certificate xxxxxx.com/fullchain.cer;
  20.   ssl_certificate_key xxxxxx.com/xxxxxx.com.key;
  21.   ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  22.   ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
  23.   ssl_prefer_server_ciphers on;
  24.   ssl_session_timeout 10m;
  25.   ssl_session_cache builtin:1000 shared:SSL:10m;
  26.   ssl_buffer_size 1400;
  27.   add_header Strict-Transport-Security max-age=15768000;
  28.   ssl_stapling on;
  29.   ssl_stapling_verify on;
  30.   server_name f.xxxxxx.com;
  31.   access_log off;
  32.   index index.html index.htm index.php;
  33.   root /data/wwwroot/f.xxxxxx.com;
  34.   if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
  35.   
  36.   include /usr/local/nginx/conf/rewrite/none.conf;
  37.   #error_page 404 /404.html;
  38.   #error_page 502 /502.html;
  39.   
  40.   location ~ [^/].php(/|$) {
  41.     #fastcgi_pass remote_php_ip:9000;
  42.     fastcgi_pass unix:/dev/shm/php-cgi.sock;
  43.     fastcgi_index index.php;
  44.     include fastcgi.conf;
  45.   }
  46.   location ~ .*.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
  47.     expires 30d;
  48.     access_log off;
  49.   }
  50.   location ~ .*.(js|css)?$ {
  51.     expires 7d;
  52.     access_log off;
  53.   }
  54.   location ~ /(.user.ini|.ht|.git|.svn|.project|LICENSE|README.md) {
  55.     deny all;
  56.   }
  57.   location /.well-known {
  58.     allow all;
  59.   }
  60. }

复制代码

问题应该在:反代吧

FAT2048 发表于 2022-4-10 11:38
问题应该在:反代吧

反代用的网上宝塔用的代码。

新建一个反代,然后编辑配置文件替换:
  1. #PROXY-START/
  2. location ~ ^/(ws|terminal/.+)$  {
  3.         proxy_pass http://ip:站点访问端口;
  4.         proxy_set_header Upgrade $http_upgrade;
  5.         proxy_set_header Connection "Upgrade";
  6.         proxy_set_header Host $host;
  7.     }
  8. #PROXY-END/

复制代码

Sos

8EBE946C-6A66-4B87-A993-6E42ADA28BEA.jpeg (10.84 KB, 下载次数: 0)

下载附件

半小时前 上传

主菜单 发表于 2022-4-10 11:47
新建一个反代,然后编辑配置文件替换:

大佬,俺用的不是宝塔,只要在配置文件中替换似乎也不行。

本帖最后由 笑花落半世琉璃 于 2022-4-10 11:54 编辑

你这真就什么抖往里搬

  1. server {
  2.   listen 80;
  3.   listen [::]:80;
  4.   listen 443 ssl http2;
  5.   listen [::]:443 ssl http2;
  6.   ssl_certificate xxxxxx.com/fullchain.cer;
  7.   ssl_certificate_key xxxxxx.com/xxxxxx.com.key;
  8.   ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  9.   ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
  10.   ssl_prefer_server_ciphers on;
  11.   ssl_session_timeout 10m;
  12.   ssl_session_cache builtin:1000 shared:SSL:10m;
  13.   ssl_buffer_size 1400;
  14.   add_header Strict-Transport-Security max-age=15768000;
  15.   ssl_stapling on;
  16.   ssl_stapling_verify on;
  17.   server_name f.xxxxxx.com;
  18.   access_log off;
  19.   index index.html index.htm index.php;
  20.   root /data/wwwroot/f.xxxxxx.com;
  21.   if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
  22.   
  23.   include /usr/local/nginx/conf/rewrite/none.conf;
  24.   #error_page 404 /404.html;
  25.   #error_page 502 /502.html;
  26.   
  27.   location /
  28.         {
  29.                 proxy_pass http://127.0.0.1:8008;
  30.                 proxy_set_header Host $host;
  31.         }
  32.         location ~ ^/(ws|terminal/.+)$  {
  33.         proxy_pass http://127.0.0.1:8008;
  34.         proxy_http_version 1.1;
  35.         proxy_set_header Upgrade $http_upgrade;
  36.         proxy_set_header Connection "Upgrade";
  37.         proxy_set_header Host $host;
  38.         }
  39.   location ~ .*.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
  40.     expires 30d;
  41.     access_log off;
  42.   }
  43.   location ~ .*.(js|css)?$ {
  44.     expires 7d;
  45.     access_log off;
  46.   }
  47.   location ~ /(.user.ini|.ht|.git|.svn|.project|LICENSE|README.md) {
  48.     deny all;
  49.   }
  50.   location /.well-known {
  51.     allow all;
  52.   }
  53. }

复制代码

笑花落半世琉璃 发表于 2022-4-10 11:53
你这真就什么抖往里搬

求大佬指点下。

Erax 发表于 2022-4-10 11:55
求大佬指点下。

上面不是给你贴好了

还是不中, 那些个css 都是404。