jenkinsサーバーを運用しているのだが、これに広告をいれれば、誰か開くんじゃね?と思い入れてみました。
http_sub_moduleとともに、configureしてあげるのもいいが、アプデが怖い。
調べてみると、nginx-fullには、ngx_http_substitutions_filter_moduleが入っていて、これを使えばいけた。
apt install nginx-full
んで、/etc/nginx/conf.dにリバースプロキシーの設定を書く。
http_sub_moduleとともに、configureしてあげるのもいいが、アプデが怖い。
調べてみると、nginx-fullには、ngx_http_substitutions_filter_moduleが入っていて、これを使えばいけた。
apt install nginx-full
んで、/etc/nginx/conf.dにリバースプロキシーの設定を書く。
server {
listen 80;
server_name jenkins.haniokasai.com;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Accept-Encoding "";//gzipがなんとからしい
subs_filter_types text/html; //対象を決める
subs_filter '</header>' '</header><script async src=\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script><ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"かきかえて\" data-ad-slot=\"かきかえて\" data-ad-format=\"auto\"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
';
}
}
これで、nginxをリスタートをすると表示される。
0 件のコメント:
コメントを投稿