搜尋
首頁後端開發php教程Nginx - Windows下Nginx基本安裝與配置

Nginx 是一個輕量級的高效能 Http WebServer,以事件驅動方式編寫,因此相比 Apache 而言,Nginx 更加穩定、性能更好,而且配置簡單,資源佔用較低。
1. 安裝Nginx 
1. 安裝Nginx 
從v0.7.52 開始,Nginx 開始發布Windows 版本的Nginx,你可以在其官方網站上面下載:http://nginx.net可,這裡解壓縮到c:nginx目錄。 
2. 啟動Nginx 
命令列進入c:nginx目錄,執行nginx.exe,啟動控制台視窗。預設啟用80埠。用過Tomcat的人都希望能在控制台看到啟動日誌,nginx的日誌卻不得不查看logs目錄下的對應log檔。
3. 訪問歡迎html頁 
在瀏覽器中訪問http://localhost,可以看到預設的歡迎頁. 
4.Nginx 。於是關閉控制台視窗。可是再造訪http://localhost依然有效。查看進程,發現nginx根本沒有被關閉。因此若要徹底關掉nginx,應該是 

Command代碼  

nginx -s stop  usage
     
  1. 或使用windows的taskkill指令: 

Command程式碼  
🠎
5. Ngnix常用配置

 

Nginx的所有配置都預設使用conf/nginx.conf文件,其地位相當於apache的httpd.conf文件。當運行nginx.exe暗含運行了nginx -c confnginx.conf. 如果想使用自己定義的conf文件如my.conf,命令為nginx -c confmy.conf. 
  1. 常用配置如下: 

Nginx .conf程式碼  
  1. http {  
  2.   server {  
  3.        listen  80;   
  4.     location / {  
  5. . 預設主頁目錄在nginx安裝目錄的html子目錄。         root   html;  
  6.         index  index.html index.htm;  
  7.         # 3. 沒有索引頁時,羅列文件和子目錄  
  8.         autoindex on;  
  9.         autoindex_exact_size on ;  
  10.         autoindex_localtime on;  
  11.      
  12.     location /tshirt {  
  13.     alias index.htm;  
  14.     }  
  15.   }     server {  
  16.     listen          80
  17.  server_name     www.emb.info;  
  18.     access_log emb.info/logs/access.log;  
  19.       index index.html;  
  20.       root  emb.info/htdocs;  
  21.     }  
  22.   }  }  32平台編譯版支援哪些模組。我這裡的結果是: 
  23. Log程式碼  
    1. nginx 版本:nginx/0.7.65  
    2. TLS ir=objs.msvc 8   
    3. --crossbuild= win32
    4. --with-debug --prefix=   
    5. --conf-path=conf/nginx.conf   
    6. -- http -log-path=logs/access.log   
    7. --error-log-path=logs/error.log   
    8. --sbin-path=nginx - 身體-temp-path=temp/client_body_temp   
    9. --http-proxy-temp-path=temp/proxy_temp   
    10. --http-fastgi-temp-tempgi-cm-cm-c與-cc-opt=-DFD_SETSIZE=
    11. 1024   
    12. --with-pcre=objs.msvc8/lib/pcre-7.9
    13. o/想法/8599999% -
    14. 0.9.8k   
    15. --with-openssl-opt=enable-tlsext   
    16. --with-zlib=objso.
    17. - -with-select_module   
    18. --with-http_ssl_module   
    19. --with-http_realip_module 
    20. --with-http_sub _module  
    21. --with- http_dav_module
    22. --with-http_stub_status_module   
    23. --with-http_flv_module  --with-http_random_index _module   
    24. --with-http_secure_link_module   
    25. - - with-mail   
    26. --with-mail_ssl_module   
    27. --with-ipv6  
    28. --with-ipv6  
    29. 3ache開發測試使用,對於產品平台,應該重新編譯自己想要的win32版本,或是在linux下使用更方便。 以上就介紹了Nginx - Windows下Nginx的基本安裝和配置,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。
陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
如何使PHP應用程序更快如何使PHP應用程序更快May 12, 2025 am 12:12 AM

tomakephpapplicationsfaster,關注台詞:1)useopcodeCachingLikeLikeLikeLikeLikePachetoStorePreciledScompiledScriptbyTecode.2)MinimimiedAtabaseSqueriSegrieSqueriSegeriSybysequeryCachingandeffeftExting.3)Leveragephp7 leveragephp7 leveragephp7 leveragephpphp7功能forbettercodeefficy.4)

PHP性能優化清單:立即提高速度PHP性能優化清單:立即提高速度May 12, 2025 am 12:07 AM

到ImprovephPapplicationspeed,關注台詞:1)啟用opcodeCachingwithapCutoredUcescriptexecutiontime.2)實現databasequerycachingingusingpdotominiminimizedatabasehits.3)usehttp/2tomultiplexrequlexrequestsandreduceconnection.4 limitesclection.4.4

PHP依賴注入:提高代碼可檢驗性PHP依賴注入:提高代碼可檢驗性May 12, 2025 am 12:03 AM

依赖注入(DI)通过显式传递依赖关系,显著提升了PHP代码的可测试性。1)DI解耦类与具体实现,使测试和维护更灵活。2)三种类型中,构造函数注入明确表达依赖,保持状态一致。3)使用DI容器管理复杂依赖,提升代码质量和开发效率。

PHP性能優化:數據庫查詢優化PHP性能優化:數據庫查詢優化May 12, 2025 am 12:02 AM

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi

簡單指南:帶有PHP腳本的電子郵件發送簡單指南:帶有PHP腳本的電子郵件發送May 12, 2025 am 12:02 AM

phpisusedforsenderemailsduetoitsbuilt-inmail()函數andsupportivelibrariesLikePhpMailerAndSwiftMailer.1)usethemail()functionForbasiceMails,butithasimails.2)butithasimail.2)

PHP性能:識別和修復瓶頸PHP性能:識別和修復瓶頸May 11, 2025 am 12:13 AM

PHP性能瓶颈可以通过以下步骤解决:1)使用Xdebug或Blackfire进行性能分析,找出问题所在;2)优化数据库查询并使用缓存,如APCu;3)使用array_filter等高效函数优化数组操作;4)配置OPcache进行字节码缓存;5)优化前端,如减少HTTP请求和优化图片;6)持续监控和优化性能。通过这些方法,可以显著提升PHP应用的性能。

PHP的依賴注入:快速摘要PHP的依賴注入:快速摘要May 11, 2025 am 12:09 AM

依賴性注射(DI)InphpisadesignPatternthatManages和ReducesClassDeptions,增強量強制性,可驗證性和MATIALWINABIOS.ItallowSpasspassingDepentenciesLikEdenciesLikedAbaseConnectionStoclasseconnectionStoclasseSasasasasareTers,interitationAseTestingEaseTestingEaseTestingEaseTestingEasingAndScalability。

提高PHP性能:緩存策略和技術提高PHP性能:緩存策略和技術May 11, 2025 am 12:08 AM

cachingimprovesphpermenceByStorcyResultSofComputationsorqucrouctationsorquctationsorquickretrieval,reducingServerLoadAndenHancingResponsetimes.feftectivestrategiesinclude:1)opcodecaching,whereStoresCompiledSinmememorytssinmemorytoskipcompliation; 2)datacaching datacachingsingMemccachingmcachingmcachings

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

WebStorm Mac版

WebStorm Mac版

好用的JavaScript開發工具

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

mPDF

mPDF

mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

PhpStorm Mac 版本

PhpStorm Mac 版本

最新(2018.2.1 )專業的PHP整合開發工具