今天給各位分享nginx下載的知識,其中也會對nginx官方網(wǎng)站進行解釋,如果能碰巧解決你現(xiàn)在面臨的問題,別忘了關注本站,現(xiàn)在開始吧!

如何安裝nginx
1)下載地址:
2)啟動
解壓至c:\nginx,運行nginx.exe(即nginx -c conf\nginx.conf),默認使用80端口,日志見文件夾C:\nginx\logs
3)使用
4)關閉
nginx -s stop 或taskkill /F /IM nginx.exe nul
5)常用配置
C:\nginx\conf\nginx.conf,使用自己定義的conf文件如my.conf,命令為nginx -c conf\my.conf
常用配置如下:
Nginx.conf代碼
http {
server {
#1.偵聽80端口
listen 80;
location / {
# 2. 默認主頁目錄在nginx安裝目錄的html子目錄。
root html;
index index.html index.htm;
# 3. 沒有索引頁時,羅列文件和子目錄
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;
}
# 4.指定虛擬目錄
location /tshirt {
alias D:\programs\Apache2\htdocs\tshirt;
index index.html index.htm;
}
}
# 5.虛擬主機配置
server {
listen 80;
server_name ;
access_log emb.info/logs/access.log;
location / {
index index.html;
root emb.info/htdocs;
}
}
}
http {
server {
#1.偵聽80端口
listen 80;
location / {
# 2. 默認主頁目錄在nginx安裝目錄的html子目錄。
root html;
index index.html index.htm;
# 3. 沒有索引頁時,羅列文件和子目錄
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;
}
# 4.指定虛擬目錄
location /tshirt {
alias D:\programs\Apache2\htdocs\tshirt;
index index.html index.htm;
}
}
# 5.虛擬主機配置
server {
listen 80;
server_name ;
access_log emb.info/logs/access.log;
location / {
index index.html;
root emb.info/htdocs;
}
}
}
小提示:
運行nginx -V可以查看該Win32平臺編譯版支持哪些模塊。我這里的結果為:
Log代碼
nginx version: nginx/0.7.65
TLS SNI support enabled
configure arguments:
--builddir=objs.msvc8
--crossbuild=win32
--with-debug --prefix=
--conf-path=conf/nginx.conf
--pid-path=logs/nginx.pid
--http-log-path=logs/access.log
--error-log-path=logs/error.log
--sbin-path=nginx.exe
--http-client-body-temp-path=temp/client_body_temp
--http-proxy-temp-path=temp/proxy_temp
--http-fastcgi-temp-path=temp/fastcgi_temp
--with-cc-opt=-DFD_SETSIZE=1024
--with-pcre=objs.msvc8/lib/pcre-7.9
--with-openssl=objs.msvc8/lib/openssl-0.9.8k
--with-openssl-opt=enable-tlsext
--with-zlib=objs.msvc8/lib/zlib-1.2.3
--with-select_module
--with-http_ssl_module
--with-http_realip_module
--with-http_addition_module
--with-http_sub_module
--with-http_dav_module
--with-http_stub_status_module
--with-http_flv_module
--with-http_gzip_static_module
--with-http_random_index_module
--with-http_secure_link_module
--with-mail
--with-mail_ssl_module
--with-ipv6
nginx version: nginx/0.7.65
TLS SNI support enabled
configure arguments:
--builddir=objs.msvc8
--crossbuild=win32
--with-debug --prefix=
--conf-path=conf/nginx.conf
--pid-path=logs/nginx.pid
--http-log-path=logs/access.log
--error-log-path=logs/error.log
--sbin-path=nginx.exe
--http-client-body-temp-path=temp/client_body_temp
--http-proxy-temp-path=temp/proxy_temp
--http-fastcgi-temp-path=temp/fastcgi_temp
--with-cc-opt=-DFD_SETSIZE=1024
--with-pcre=objs.msvc8/lib/pcre-7.9
--with-openssl=objs.msvc8/lib/openssl-0.9.8k
--with-openssl-opt=enable-tlsext
--with-zlib=objs.msvc8/lib/zlib-1.2.3
--with-select_module
--with-http_ssl_module
--with-http_realip_module
--with-http_addition_module
--with-http_sub_module
--with-http_dav_module
--with-http_stub_status_module
--with-http_flv_module
--with-http_gzip_static_module
--with-http_random_index_module
--with-http_secure_link_module
--with-mail
--with-mail_ssl_module
--with-ipv6
顯然,最經(jīng)常用的memcache, rewrite模塊都沒在其中,因此該win32編譯版本僅能供基本開發(fā)測試使用,對于產(chǎn)品平臺,應該重新編譯自己想要的win32版本,或者在linux下使用更方便。
6)查看nginx進程
tasklist /fi "imagename eq nginx.exe",如下顯示:
映像名稱 PID 會話名 會話# 內存使用
========================= ======== ================ =========== ============
nginx.exe 8944 Console 1 5,128 K
nginx.exe 6712 Console 1 5,556 K
7)nginx常用命令
nginx -s stop 強制關閉
nginx -s quit 安全關閉
nginx -s reload 改變配置文件的時候,重啟nginx工作進程,來時配置文件生效
nginx -s reopen 打開日志文件
8)其它
可以通過配置文件開啟多個nginx工作進程,但同時只有其中一個nginx工作進程在工作,其他的阻塞等待。
一個nginx工作進程最多同時可以處理1024個連接。
nginx中需要共享內存的cache或者模塊無法在windows下正常使用。
不過,nginx官方正在改進,將來nginx會以服務的方式運行,使用 I/O completion ports代替select方法,使多個工作進程能并發(fā)工作。
要使用nginx配合php-cgi使用,需要修改環(huán)境變量,否則,php-cgi運行一定次數(shù)就推出,需要重啟,設置PHP_FCGI_MAX_REQUESTS這個變量為0即可。
以上在win7上通過。
8)nginx以windows服務形式啟動
1.下載微軟兩個工具:
instsrv.exe srvay.exe
2.執(zhí)行命令:
instsrv Nginxc:/nginx/srvany.exe
3.配置Nginx的運行參數(shù)
可以直接將配置導入到注冊表
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/NGINX/Parameters]
"Application"="C://nginx//nginx.exe"
"AppParameters"=""
"AppDirectory"="C://nginx//"
注意:windows 下的Nginx 內置的module 很多沒有,用Nginx -V 命令查看。
9)Nginx下部署mono+asp.net環(huán)境
1、從Mono for Windows中提取FastCGI-Mono-Server
2、Nginx nginx.conf 的配置:
worker_processes 1;
error_log logs/error-debug.log info;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type text/plain;
sendfile on;
keepalive_timeout 65;
index index.html index.htm;
server {
listen 80;
server_name yourdomain.com;
index index.aspx default.aspx;
location / {
root D:\www/yourwebapp;
fastcgi_pass 127.0.0.1:8000;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
}
將上面的 FastCGI-Mono-Server 提取出來,所有文件全部注冊到 GAC(否則 Web 應用會找不到他們,當然你也可以直接放到 webapp/bin),然后解壓到某個文件夾,這里假設為 D:/FastCGI-Mono-Server。
之后我們就可以按下列命令運行 FastCGI:
fastcgi-mono-server2 /socket=tcp:127.0.0.1:8000 /root="D:\www\yourwebapp" /applications=yourdomain.com:/:. /multiplex=True
最后執(zhí)行運行 Nginx 服務器,我們的 ASP.Net 程序就能脫離 IIS。
h265格式視頻播放操作方法是什么
h265格式視頻播放操作方法:先在網(wǎng)上下載一個Nginx服務,將你要播放的視頻復制進去。具體操作如下:
1、首先,播放H.265的視頻流需要libDecoder.wasm文件,該文件只能在Nginx服務下才可以使用。所以我們需要先在網(wǎng)上下載一個Nginx服務(這里以nginx-1.21.5為例)。
2、接著,在我們npm上下載最新的EasyPlayer。
3、將element里猛冊的所有文件全部復制到nginx里的html里,并將之前的index.html備枝中宏份。
4、然后啟動Nginx服務,在nginx.conf里查培禪看index.html頁面的端口(默認80端口),在瀏覽器訪問127.0.0.1:80。
5、最后,將H.265的視頻流放進去。
就可以正常播放了。
h265視頻ITU-T VCEG繼H264之后所制定的新的視頻編碼標準。H265標準圍繞著現(xiàn)有的視頻編碼標準H264,保留原來的某些技術,同時對一些相關的技術加以改進。新技術使用先進的技術用以改善碼流、編碼質量、延時和算法復雜度之間的關系,達到最优化設置。
求《NginxLua開發(fā)實戰(zhàn)》全文免費下載百度網(wǎng)盤資源,謝謝~
《Nginx Lua開發(fā)實戰(zhàn)》百度網(wǎng)盤pdf最新全集下載:
鏈接:
?pwd=urpr 提取碼:urpr
簡介:這是一部講解如何在Nginx中使用Lua開發(fā)應用系統(tǒng)的實戰(zhàn)類著作,作者是一位擁有超過20年研發(fā)經(jīng)驗的資深技術專家,內容的權威性毋庸置疑。
Nginx作為互聯(lián)網(wǎng)應用系統(tǒng)中的核心服務,被有廣泛應用。Nginx通過配置可以實現(xiàn)負載均衡、反向代理等功能,還可以通過擴展開發(fā)更為復雜的業(yè)務邏輯。這其中,使用Lua語言開發(fā)是最方便和最流行的方法。本書以應用系統(tǒng)開發(fā)為主線,講解了相關服務、模塊和開發(fā)手冊,并提供了大量真實的案例。 ?









