nginx 啟動報錯 unknown directive "server"
使用phpStudy自帶文字編輯器修改了vhosts.conf.再次啟動nginx的時候,發現nginx死活啟動不起來,找到nginx/logs/error.log,開啟一看,錯誤資訊如下:
conf/vhosts.conf內容如下:
這語法根本沒有錯。如果我把vhosts.conf的內容全部清空,再次啟動nginx,還是會啟動失敗,error.log報錯更奇怪,報錯內容如下:
都沒有任何內容的conf檔案也會報錯?
文字編輯器沒有內容可以顯示,並不一定代表檔案本身一定沒有內容,比如UTF-8 的BOM頭。
想到這裡,再加上當前檔案的編碼格式的確已經變成為 UTF-8-BOM,嘗試將檔案編碼格式修改為UTF-8,重啟nginx,問題解決。
相關文章
- windows 中nginx奇葩報錯 nginx: [emerg] unknown directive "#" in nginx/conf/nginx.conf:3WindowsNginx
- 解決nginx: [emerg] unknown directive “stream“ in /etc/nginx/nginx.conf問題Nginx
- Centos7啟動Nginx報錯。CentOSNginx
- zabbix-server啟動報錯解決Server
- MySQL啟動報錯:The server quit without updating PID fileMySqlServerUI
- spring boot 啟動時報錯The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized orJDBC driverSpring BootServerZedJDBC
- Nginx啟動不了報錯未找到命令的解決方法(- bash: nginx: 未找到命令)Nginx
- Vuex中使用報錯unknown mutation typeVue
- FastCGI sent in stderr: "Primary script unknown" 報錯AST
- myeclipse啟動報錯Eclipse
- 記錄一個 Nginx-FastCGI-"Primary script unknown" 錯誤NginxAST
- SQL server開啟 安裝包時報錯SQLServer
- 如何解決 Nginx 與 FastCGI 通訊錯誤 "Primary script unknown"?NginxAST
- Homestead 啟動 elasticsearch 報錯Elasticsearch
- 本地nacos啟動報錯
- WebLogic啟動報Could not get the server file lockWebServer
- nginx: [emerg] "user" directive is not allowed here in /etc/nginx/conf.d/nginx.conf:1Nginx
- Mac 上啟動 appium 報錯MacAPP
- apache啟動報錯:httpd: aprApachehttpd
- 解決啟動openfeign報錯
- laravel sail 首次啟動報錯LaravelAI
- freeipa server安裝報錯Server
- Redis 啟動報錯Address already in useRedis
- Xcode啟動RN報錯"`fsevents` unavailable"XCodeAI
- mongodb啟動報錯怎麼辦MongoDB
- siebel server 啟動時報Cleaning up previous execution of【轉】Server
- webpack中css使用行內註釋報錯Unknown wordWebCSS
- pbootcms模板報錯提示PHP Warning: Unknown: open_basedir restrictionbootPHPREST
- mysql 啟動報錯Can't connect to local MySQL server through socket '/data/mysql/mysql/mysql.sock'(111)MySqlServer
- Mock server自啟動MockServer
- Nginx安裝啟動過程報錯libpcre.so.1 cannot open shared object file: No such file or directoryNginxObject
- sshd啟動報錯Could not load host key
- 測試類啟動報錯缺失servletWebServerApplicationContextServletWebServerAPPContext
- 網站報錯:“Database Server Error”網站DatabaseServerError
- 報錯:net::err_unknown_url_scheme的解決辦法Scheme
- nginx啟動,停止命令Nginx
- react-native-vision-camera 掃二維碼報錯 [unknown/unknown] Waiting for the barcode module to be downloaded. Please wait.]ReactAI
- nginx部署(13:Permission denied)報錯Nginx