編譯安裝基於nginx與lua的高性能web平臺-openresty

来源:https://www.cnblogs.com/xiongyoutom/archive/2018/04/10/8777236.html
-Advertisement-
Play Games

1、首先編譯安裝nginx(不多說) 2、開始安裝openresty cd /usr/local/src wget https://openresty.org/download/openresty-1.11.2.2.tar.gz tar xf openresty-1.11.2.2.tar.gz cd ...


1、首先編譯安裝nginx(不多說)

2、開始安裝openresty

cd /usr/local/src

wget https://openresty.org/download/openresty-1.11.2.2.tar.gz

tar xf openresty-1.11.2.2.tar.gz

cd openresty-1.11.2.2/

編譯開始

--prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/log/nginx.pid --error-log-path=/usr/local/nginx/log/error.log --http-log-path=/usr/local/nginx/log/access.log --lock-path=/var/lock/nginx.lock --with-luajit --with-http_gunzip_module --with-pcre --with-pcre-jit --with-http_perl_module --with-ld-opt="-Wl,-E" --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-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-select_module --with-poll_module --with-file-aio --with-http_degradation_module --with-libatomic --http-client-body-temp-path=/var/tmp/nginx/client_body --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi

編譯過程中會出現各種確實庫和模塊的錯誤,根據提示自行補充缺少的依賴庫和模塊。

安裝

gmake && gmake install

查看是否安裝成功:

nginx -v

創建目錄

mkdir -p /var/tmp/nginx

配置

user                                    nginx;
pid                                     /var/run/nginx.pid;
 
worker_processes                        2;
worker_rlimit_nofile                    65534;
 
events {
    use                                 epoll;
    worker_connections                  65534;
    multi_accept                        on;
}
 
http {
    client_body_buffer_size             16k;
    client_body_timeout                 30s;
    client_header_buffer_size           2k;
    large_client_header_buffers         4 16k;
    client_header_timeout               30s;
    client_max_body_size                8m;
    keepalive_timeout                   300;
    output_buffers                      2 16k;
    send_timeout                        60s;
    server_names_hash_bucket_size       128;
    reset_timedout_connection           on;
 
#gzip
    gzip on;
    gzip_min_length                     512;
    gzip_buffers                        16 4k;
    gzip_comp_level                     4;
    gzip_proxied                        any;
 
#cache
    open_file_cache                     max=204800 inactive=60s;
    open_file_cache_errors              on;
    open_file_cache_min_uses            1;
    open_file_cache_valid               60s;
 
#proxy
    proxy_buffer_size                   32k;
    proxy_buffers                       8 32k;
    proxy_busy_buffers_size             32k;
    proxy_cache_path                    /var/tmp/nginx/proxy_cache levels=1:2 keys_zone=content:200m inactive=30d max_size=10g;
    proxy_cache_path                    /var/tmp/nginx/proxy_cache/enginx levels=1:2 keys_zone=enginx:200m inactive=30d max_size=10g;
    proxy_cache_key                     $host$proxy_host$uri$is_args$args;
    proxy_connect_timeout               60s;
    proxy_read_timeout                  300s;
    proxy_send_timeout                  300s;
    proxy_temp_file_write_size          32k;
    proxy_temp_path                     /var/tmp/nginx/proxy_temp;
    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-Scheme $scheme;
    proxy_set_header                    Accept-Encoding '';
    real_ip_header                      X-Forwarded-For;
 
#log
    log_format main                    '$remote_addr - $remote_user [$time_local] "$request" $http_host ' 
                                        '$status $body_bytes_sent "$http_referer" '
                                        '"$http_user_agent" "$http_x_forwarded_for" '
                                        '$upstream_addr $upstream_status $upstream_cache_status "$upstream_http_content_type" $upstream_response_time > $request_time';
 
    open_log_file_cache                 max=204800 inactive=20s valid=1m min_uses=1;
    error_log                           /var/log/nginx/error.log error;
 
#host configure file
    include                             /usr/local/nginx/conf.d/*.ngx.conf;
 
#main configure
    server_tokens                       off;
    sendfile                            off;
    tcp_nopush                          on;
    tcp_nodelay                         off;
    charset                             utf-8;
    include                             /usr/local/nginx/mime.types;
    default_type                        text/html;
}

創建目錄

mkdir /usr/local/nginx/conf.d

新建文件

local.ngx.conf

server {
 
    listen                  80;
 
    server_name             www.web-t1.t.com;
 
    return 301 http://web-t1.t.com$request_uri;
 
}
 
server {
 
    listen                  80;
 
    server_name             web-t1.t.com;
 
    root                    /usr/local/html/web-t1.t.com/public_html/;
 
    access_log              /usr/local/html/web-t1.t.com/logs/ngx_access.log main;
 
    location / {
 
        index               index.html;
 
    }
 
}

啟動測試停止nginx: nginx  、nginx -t 、nginx -s stop


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 1. 右鍵點擊任務管理器 2.打開資源監視器 3.搜索任務,結束任務(可能會死機) ...
  • linux 在整個架構上可以看作是三層: 1.底層代碼, (引導層strip) 跟硬體溝通的那一層的代碼(可能是彙編+c), 驅動底層的; strain: n./v. 拉緊, 張力, 氣質, 風格, 樂曲(這個詞的意思很多): 中間層代碼, OS層,用來管理文件系統,記憶體,作業調度等. 裡面的實現包 ...
  • 今天在知乎上看到一篇十分有趣的問題: 如何評價微軟高級工程師痴迷於soft link這一linux常見概念? 雖然又是知名撕逼王曾某的撕逼帖,但是我還是想就題目中鏈接的問題簡單地講講。 什麼是鏈接? 鏈接簡單說實際上是一種文件共用的方式,是 POSIX 中的概念,主流文件系統都支持鏈接文件。 它是用 ...
  • umask使用方法 A 什麼是umask? 當我們登錄系統之後創建一個文件總是有一個預設許可權的,那麼這個許可權是怎麼來的呢?這就是umask乾的事情。umask設置了用戶創建文件的預設 許可權,它與chmod的效果剛好相反,umask設置的是許可權“補碼”,而chmod設置的是文件許可權碼。一般在/etc/ ...
  • 一.續Centos7下部署Node,Nginx安裝部署: Nginx選擇安裝的是編譯版(附下載地址:https://nginx.org/download/),根據自己的系統環境選擇。 1.進入保存下載文件的路徑,cd進入文件保存路徑,命令: cd /usr/local/src 2.下載文件,我這選擇 ...
  • 一、 三極體簡介 種類 根據構成三極體中的三塊半導體類型的不同,有NPN型和PNP型兩種;根據材料的不同有硅管和鍺管兩種,常見的硅管,Vbe間的壓降是0.7V,鍺管則是0.2V。 作用 三極體有三種狀態,放大、截止和飽和,是一種控制電流的半導體器件。利用不同的狀態特性,三極體的主要作用有兩個: 1. ...
  • LCOW containers can now be run next to Windows containers.Use '--platform=linux' in Windows container mode to run Linux images.This is an experimental ...
  • 1.在任務欄右擊-任務管理器 2. ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...