最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

nginx 快速使用

2021-11-09 14:55 作者:keyboyone  | 我要投稿

前端人員nginx快速使用


1.下載安裝

下載地址:?http://nginx.org/en/download.html?


2.解壓

簡(jiǎn)單說(shuō)明下文件的作用

????conf??????????存放默認(rèn)配置文件,在make?install后,會(huì)拷貝到安裝目錄中去???? ????contrib????????存放一些實(shí)用工具,如geo配置生成工具(geo2nginx.pl)

????html??????????存放默認(rèn)的網(wǎng)頁(yè)文件,在make?install后,會(huì)拷貝到安裝目錄中去 ????docs??????????文檔 ????logs??????????日志 ????temp????????????臨時(shí)文件

所以說(shuō)在前端簡(jiǎn)單使用的時(shí)候只要關(guān)注html文件夾就好

如果還要配置其他就關(guān)注配置文件conf

其他的暫時(shí)還沒(méi)用上

3.啟動(dòng)nginx

????建議在cnd下啟動(dòng)因?yàn)槿绻梢钥吹綀?bào)錯(cuò)信息

????在未配置環(huán)境變量的情況下要在當(dāng)前目錄打開(kāi)cmd?

???

?在cmd里面輸入 nginx 回車(chē)

????在沒(méi)有報(bào)錯(cuò)情況下到瀏覽器里面打開(kāi)http://127.0.0.1/會(huì)出現(xiàn)下界面

表示已經(jīng)成功運(yùn)行


4.前端代碼的替代

? ? 前端代碼在html里面

????因?yàn)閚ginx默認(rèn)配置好路徑和端口所以只要把前端代碼放在html里面就能訪問(wèn)了

????

????里面有index.html和50x.html可以刪掉放自己的前端代碼也可以留著

????



? ? 把寫(xiě)的前端代碼放進(jìn)來(lái)

????前端代碼架構(gòu)

????代碼完整路徑D:\LHQ\echarts\nginx-1.21.4\nginx-1.21.4\html\秋梅的校園出入\QR-code.html

????如果關(guān)掉nginx就重新開(kāi)啟,沒(méi)有的話就直接在瀏覽器輸入http://127.0.0.1/秋梅的校園出入/QR-code.html

????訪問(wèn)網(wǎng)址就是? ip+相對(duì)html的路勁?

????如果部署在服務(wù)器的話其他人也能訪問(wèn)了

????


????就這樣前端的代碼就可以部署在服務(wù)器了


nginx服務(wù)器可以配置很多東西,我的博客,直播服務(wù)器、反向代理、物聯(lián)網(wǎng)服務(wù)器 等都是用nginx?

以后再講其他動(dòng)態(tài)配置


5.進(jìn)一步講下配置文件conf

????nginx.conf文件

#user??nobody;#啟動(dòng)用戶(hù)配置在部署服務(wù)器可能有權(quán)限的問(wèn)題?

worker_processes??1;

#這是?Nginx?服務(wù)器并發(fā)處理服務(wù)的關(guān)鍵配置,worker_processes?值越大,可以支持的并發(fā)處理量也越多,但是會(huì)受到硬件、軟件等設(shè)備的制約 #日志文件 #error_log??logs/error.log; #error_log??logs/error.log??notice; #error_log??logs/error.log??info; #pid????????logs/n?

?ginx.pid; events?{ ????worker_connections??1024; } #events?塊涉及的指令主要影響?Nginx?服務(wù)器與用戶(hù)的網(wǎng)絡(luò)連接,常用的設(shè)置包括是否開(kāi)啟對(duì)多?work?process?下的網(wǎng)絡(luò)連接進(jìn)行序列化,是否允許同時(shí)接收多個(gè)網(wǎng)絡(luò)連接,選取哪種事件驅(qū)動(dòng)模型來(lái)處理連接請(qǐng)求,每個(gè)?word?process?可以同時(shí)支持的最大連接數(shù)等。 上述例子就表示每個(gè)?work?process?支持的最大連接數(shù)為?1024. 這部分的配置對(duì)?Nginx?的性能影響較大,在實(shí)際中應(yīng)該靈活配置。 #http?塊 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?塊 每個(gè)?http?塊可以包括多個(gè)?server?塊,而每個(gè)?server?塊就相當(dāng)于一個(gè)虛擬主機(jī)。 ????#而每個(gè)?server?塊也分為全局?server?塊,以及可以同時(shí)包含多個(gè)?locaton?塊。 ????server?{ ????????listen???????80;#端口 ????????server_name??localhost;#主機(jī)地址 ????????#charset?koi8-r; ????????#access_log??logs/host.access.log??main; ????????location?/?{ ????????????root???html;#路徑 ????????????index??index.html?index.htm; ????????} ????????#error_page??404??????????????/404.html; ????????#?redirect?server?error?pages?to?the?static?page?/50x.html ????????# ????????error_page???500?502?503?504??/50x.html; ????????location?=?/50x.html?{ ????????????root???html; ????????} ????????#?proxy?the?PHP?scripts?to?Apache?listening?on?127.0.0.1:80 ????????# ????????#location?~?\.php$?{ ????????#????proxy_pass???http://127.0.0.1; ????????#} ????????#?pass?the?PHP?scripts?to?FastCGI?server?listening?on?127.0.0.1:9000 ????????# ????????#location?~?\.php$?{ ????????#????root???????????html; ????????#????fastcgi_pass???127.0.0.1:9000; ????????#????fastcgi_index??index.php; ????????#????fastcgi_param??SCRIPT_FILENAME??/scripts$fastcgi_script_name; ????????#????include????????fastcgi_params; ????????#} ????????#?deny?access?to?.htaccess?files,?if?Apache's?document?root ????????#?concurs?with?nginx's?one ????????# ????????#location?~?/\.ht?{ ????????#????deny??all; ????????#} ????} ????#?another?virtual?host?using?mix?of?IP-,?name-,?and?port-based?configuration ????# ????#server?{ ????#????listen???????8000; ????#????listen???????somename:8080; ????#????server_name??somename??alias??another.alias; ????#????location?/?{ ????#????????root???html; ????#????????index??index.html?index.htm; ????#????} ????#} ????#?HTTPS?server ????# ????#server?{ ????#????listen???????443?ssl; ????#????server_name??localhost; ????#????ssl_certificate??????cert.pem; ????#????ssl_certificate_key??cert.key; ????#????ssl_session_cache????shared:SSL:1m; ????#????ssl_session_timeout??5m; ????#????ssl_ciphers??HIGH:!aNULL:!MD5; ????#????ssl_prefer_server_ciphers??on; ????#????location?/?{ ????#????????root???html; ????#????????index??index.html?index.htm; ????#????} ????#} }


nginx 快速使用的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
佛坪县| 富民县| 綦江县| 浦城县| 梧州市| 尉氏县| 石屏县| 嘉鱼县| 阿克陶县| 新巴尔虎右旗| 玉环县| 冕宁县| 龙川县| 山东省| 漯河市| 德化县| 寻乌县| 会昌县| 三穗县| 镇原县| 东乌珠穆沁旗| 上思县| 西乡县| 驻马店市| 德钦县| 南开区| 泗洪县| 崇左市| 会泽县| 肃北| 皮山县| 青田县| 新和县| 台中市| 遵化市| 乐安县| 濮阳市| 兴仁县| 五家渠市| 牟定县| 秦皇岛市|