日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

安装配置nginx加载concat模块

發布時間:2025/3/8 编程问答 16 豆豆
生活随笔 收集整理的這篇文章主要介紹了 安装配置nginx加载concat模块 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2019獨角獸企業重金招聘Python工程師標準>>>

centos7.2?x86_64

阿里開源的concat模塊,用于減少網站訪問中js和css的請求,以減輕服務器壓力;該技術即將css、js等靜態資源合并為一個或幾個資源,配合緩存可大大節省網絡傳輸時間,加快網頁加載速度。

1,安裝concat模塊需編譯安裝nginx:
yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel pcre pcre-devel git
mkdir -p /var/web/
useradd web
mkdir -p /var/web/
chown web.web /var/web/
cd /var/web/
git clone https://github.com/alibaba/nginx-http-concat.git
wget http://nginx.org/download/nginx-1.12.1.tar.gz
tar zxvf nginx-1.12.1.tar.gz
cd nginx-1.12.1
./configure --prefix=/var/web/nginx?--sbin-path=/usr/sbin/nginx --user=web --group=web --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie' --add-module=/var/web/nginx-http-concat
make
make install

2,concat模塊使用方法:

#該段代碼意味著網站根目錄下/static/目錄里的css和js才可以合并
?? ?location /static/ {
?? ??? ?concat on;
?? ??? ?concat_max_files 20;
?? ??? ?concat_unique off;
?? ??? ?concat_types text/css text/html application/javascript;
?? ?}

https://localhost/static/??/pc/style/loading.min.css,pc/js/aboutus.min.js,global/js/stats.js
該鏈接能看到對應js和css的內容即為配置concat成功可用
?

轉載于:https://my.oschina.net/u/2404183/blog/1546981

總結

以上是生活随笔為你收集整理的安装配置nginx加载concat模块的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。