Centos7 使用nginx部署vue專案

2022-07-10 00:33:15 字數 1154 閱讀 2726

#設定源

sudo rpm -uvh

#安裝yum install -y nginx

#啟動服務

systemctl start nginx.service

#關閉服務

systemctl stop nginx.service

#開機自啟

systemctl enable nginx.service

更改config資料夾下index.js(config -> index.js -> build物件)資源發布路徑

# change code like this

assetspublicpath: './',

# an highlighted block

build: )

} else

# 打包正式環境

npm run build:prod

# 打包預發布環境

npm run build:stage

# 遠端上傳 或 通過ftps工具上傳
vim /etc/nginx/nginx.conf

#在http{}修改如下

server

#跨域 ip和port自行替換

location /adminapi

}

nginx -s reload

nginx -s stop

nginx

http://ip   #此處ip是你的伺服器ip位址,例如:0.0.0.0

Centos7 部署Nginx 支援HTTPS

http ssl modulemake make install使用命令 vi etc init.d nginx 開啟編輯器,輸入如下內容 bin sh chkconfig 2345 8515 startup script for the nginx web server description n...

CentOS 7,使用yum安裝Nginx

centos 7,使用yum安裝nginx 執行以下命令 rpm ivh安裝該rpm後,我們就能在 etc yum.repos.d 目錄中看到乙個名為nginx.repo 的檔案。安裝完nginx源後,就可以正式安裝nginx了。yum install y nginx輸入命令 whereis ngi...

centos7安裝Nginx 使用nginx記錄

1 安裝各種依賴 gcc安裝,nginx原始碼編譯需要 yum install gcc c pcre pcre devel 安裝,nginx 的 http 模組使用 pcre 來解析正規表示式 yum install y pcre pcre devel zlib安裝,nginx 使用zlib對htt...