nginx作為靜態資源服務器的配置
server {
listen 80;
server_name localhost;
location /www/ {
root /data/;
index index.html index.htm;
}
location /image/ {
root /data/;
autoindex on;
}
}
創建目錄,拷貝文件
mkdir -p /data/www
mkdir /data/image
cp yellow.jpg /data/image
cp index.html /data/www
nginx -s reload
瀏覽器訪問:
http://localhost/www/index.html
http://localhost/image/yellow.jpg
nginx作為靜態資源服務器的配置
相關推薦
nginx作為靜態資源服務器的配置
nginx 靜態資源在http模塊添加: server {listen 80;server_name localhost;location /www/ {root /data/;index index.html index.htm;}location /image/ {root /data/;autoind
linux使用Nginx搭建靜態資源服務器
文件 dde 地址 需要 路徑 src linu use 一個 最近公司需要做一個宣傳片播放 視頻有點大 好幾百M 就想到使用Nginx來代理靜態資源,在過程中出現了一些問題,比如端口沒開、訪問是403等,沒有成功,後面慢慢查找問題,才發現大部分博客資料的都不全,所以在這
nginx搭建靜態資源服務器
htm dex roo rewrite user 頁面跳轉 index localhost 安裝 nginx配置訪問前端工程 1.前端工程目錄 crm-view |-- view |-- user.html 2.工程位置 C:\Users\Adminis
Nginx作為靜態資源web服務_防盜鏈配置
Nginx作為靜態資源web服務_防盜鏈配置 1、新建http_referer.html檔案 (1)touch http_referer.html (2)編輯http_referer.html檔案
Nginx作為靜態資源web服務_跨站訪問場景配置
Nginx作為靜態資源web服務_跨站訪問場景配置 跨域訪問場景演示 設施準備:兩臺雲伺服器 or 建立兩臺虛擬伺服器(VMWare、VirtureBox等) (1)騰訊雲伺服器上新增CSRF.html檔案 使用JQuery Ajax請求模擬跨域訪問: CSRF.
Nginx作為靜態資源web服務_配置語法
Nginx作為靜態資源web服務_配置語法 1、配置語法-sendfile檔案讀取 (1)核心作用 提高檔案檔案傳輸效率。 (2)sendfile語法 Syntax: send
Nginx——靜態資源服務器(一)
http restart 添加 mkdir rest cal 語法錯誤 結合 del java web的項目中,我們經常將項目部署到Tomcat或者jetty上,可以通過Tomcat或者jetty啟動的服務來訪問靜態資源。但是隨著Nginx的普及,用Nginx來
Nginx作為靜態資源web服務_防盜鏈目的
Nginx作為靜態資源web服務_防盜鏈目的 1、防盜鏈目的 目的:防止資源被盜用。 防止非正常使用者訪問,佔用網站資源,影響網站效能,勢必影響正常使用者訪問。 2、防盜鏈設定思路 &nbs
Nginx作為靜態資源web服務_跨站訪問
Nginx作為靜態資源web服務_跨站訪問 1、跨域訪問 瀏覽器同時訪問多個域名 2、為什麼瀏覽器禁止跨域訪問? 不
Nginx作為靜態資源web服務_瀏覽器快取場景演示
Nginx作為靜態資源web服務_瀏覽器快取場景演示 1、expires過期時間語法 Nginx在響應頭中新增:Cache-Control、Expires頭 Syntax: expires [modified] time;e
Nginx作為靜態資源web服務_瀏覽器快取
Nginx作為靜態資源web服務_瀏覽器快取 1、瀏覽器快取 HTTP協議定義的快取機制(如:Expire;Cache-control等) 2、瀏覽器無快取場景圖 3、瀏覽器有快取場景圖 &
Nginx作為靜態資源web服務_gzip場景演示
Nginx作為靜態資源web服務_gzip場景演示 1、Nginx壓縮模組 (1)http_gzip_module 應用支援gzip壓縮方式 (2)http_gzip_static_module
Nginx作為靜態資源web服務_靜態資源型別
Nginx作為靜態資源web服務_靜態資源型別 1、靜態資源web服務 2、靜態資源型別 (1)靜態資源概念 靜態資源:非伺服器動態執行生成的檔案。
一、CentOS7下搭建FastDFS+Nginx實現靜態圖片服務器
文件 源碼 wsgi ide 管理 配置 ror centos7 tor 在集群環境下,圖片存放在本地存在諸多限制,一般采用單獨的圖片服務器進行管理。FastDFS就是這樣一個圖片管理服務器。 環境需求,CentOS7下 一.先下載三件套,並上傳到服務器中(Nginx自行下
CentOS6.7使用nginx提供靜態資源服務,反向代理和負載均衡
ack ces entos backup max nta for docs ive 1. nginx 的簡單原理 nginx是一個高性能的HTTP和反向代理服務器,也是一個IMAP/POP3/SMTP服務器。其特點是占用內存少,並發能力強。 如果使用nginx作為web服務
HTTP靜態資源服務器搭建
run lis nginx tomcat 解析 apach gcc python3 tle 1.搭建服務器原因 前後端分離已成為互聯網項目開發的業界標準使用方式,通過nginx+tomcat的方式(也可以中間加一個nodejs)有效的進行解耦,並且前後端分離會為以後的大型分
nginx作為靜態資源伺服器和動態代理的用法示例
專案描述 vue專案使用8090埠(提供頁面),java專案使用8080埠(提供ajax介面),nginx監聽80埠。此時,nginx配置如下: #java專案伺服器使用8080埠 upstream server_java { server 127.0.0.1:8080; }
Nginx 作為靜態資源伺服器
Nginx Windows 版本的啟動停止,重新載入配置 啟動 Windows版本下載解壓後有一個nginx.exe可執行檔案,雙擊啟動。 啟動後 瀏覽器訪問http://127.0.0.1 可以看到Nginx的歡迎頁面,說明已經啟動成功。 停止 在命令列中 cd {nginx_home} 到下載
Windows下nginx作為靜態資源伺服器使用
一、Nginx下載與安裝 1、nginx官方下載地址:http://nginx.org/ 2、下載完後將壓縮包解壓即可 3、nginx配置檔案為根目錄下conf\nginx.conf 二、Nginx常用命令說明 cmd進入nginx安裝目錄 tasklist /fi "imagename e
Windows下nginx作為靜態資源伺服器使用小結
起因 最近在公司接個任務,說用nginx做靜態資源伺服器,給客戶端寫個更新程式,把更新包放nginx伺服器上。當然nginx作為一款輕量級的web伺服器/反向代理伺服器/郵件伺服器,對於這簡單的任務毛毛雨啦,在此總結一下nginx的使用,以備遺忘時翻看。