網站首頁 編程語言 正文
官網下載Windows穩定版包,解壓后,雙擊nginx.exe啟動nginx。
也可以命令行CD到nginx.exe所在目錄后,執行:start nginx來啟動服務器。
運行tasklist可以查看當前會話信息,看到如下信息說明啟動正常。
E:\Softwares\nginx-1.22.1\nginx-1.22.1>tasklist
映像名稱 ? ? ? ? ? ? ? ? ? ? ? PID 會話名 ? ? ? ? ? ? ?會話# ? ? ? 內存使用
========================= ======== ================ =========== ============
nginx.exe ? ? ? ? ? ? ? ? ? ?41136 Console ? ? ? ? ? ? ? ? ? ?4 ? ? ?7,100 K
nginx.exe ? ? ? ? ? ? ? ? ? ? 6100 Console ? ? ? ? ? ? ? ? ? ?4 ? ? ?7,456 K
這兩個進程中一個是主進程,一個是工作進程,如果nginx沒有啟動,可以到logs/error.log下面找原因。
此時在瀏覽器輸入localhost可以看到nginx默認頁面(默認啟動頁為 html/index.html)的展示。
修改端口
nginx默認的端口是80端口,可以在conf/nginx.conf中修改
http {
? ? include ? ? ? mime.types;
? ? default_type ?application/octet-stream;
? ? #log_format ?main ?'$remote_addr - $remote_user [$time_local] "$request" '
? ? # ? ? ? ? ? ? ? ? ?'$status $body_bytes_sent "$http_referer" '
? ? # ? ? ? ? ? ? ? ? ?'"$http_user_agent" "$http_x_forwarded_for"';
? ? #access_log ?logs/access.log ?main;
? ? sendfile ? ? ? ?on;
? ? #tcp_nopush ? ? on;
? ? #keepalive_timeout ?0;
? ? keepalive_timeout ?65;
? ? #gzip ?on;
? ? server {
? ? ? ? listen ? ? ? 80;
? ? ? ? server_name ?localhost;
修改端口后要使生效可以再次執行nginx.exe,或者使用命令:nginx -s reload,重啟工程,使配置文件生效。
經常會遇到瀏覽器刷新不起作用,可能是緩存引起的問題。測試的的時候通過修改端口跳過該問題。
設置項目
項目所用資源放到html目錄下,并調整好啟動頁面即可。
常用命令
nginx -s stop 強制關閉
nginx -s quit 安全關閉
nginx -s reload 改變配置文件的時候,重啟nginx工作進程,來時配置文件生效
nginx -s reopen 打開日志文件
原文鏈接:https://blog.csdn.net/iningwei/article/details/128298730
相關推薦
- 2022-12-24 Kubernetes?kubectl中Pod創建流程源碼解析_云和虛擬化
- 2022-09-09 Python?OpenCV?Canny邊緣檢測算法的原理實現詳解_python
- 2022-05-13 數據結構學習筆記——順序存儲結構實現棧
- 2024-07-13 根據腳手架archetype快速構建spring boot/cloud項目
- 2022-12-15 Golang并發編程深入分析_Golang
- 2023-07-04 LinkedBlockingQueue與ArrayBlockingQueue對比
- 2023-07-08 css如何給div添加一個條紋背景,在背景上畫一條有寬度的斜線
- 2024-03-17 針對Tomcat部署項目,修改后臺代碼,前臺網頁無變化問題的解決方案(超詳細有效)
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支