1、服務(wù)器的基本信息
1)服務(wù)器信息
| nginx服務(wù)器 | 登錄IP | 用戶名 | 密碼 |
|---|---|---|---|
| web | x.x.x.x | xxxxx | xxxxxxxx |
網(wǎng)站訪問(wèn)地址:http://x.x.x.x:8090
2、web端部署
1)登陸服務(wù)器(登陸IP,用戶名,密碼見步驟1)
方法一:利用ssh工具進(jìn)行遠(yuǎn)程登錄
2)nginx命令配置如下:
#進(jìn)入管理員身份下
sudo su
#刪除原來(lái)機(jī)器上的nignx包括配置
sudo apt-get remove nginx nginx-common
sudo apt-get purge nginx nginx-common
sudo apt-get autoremove
sudo apt-get remove nginx-full nginx-common
#安裝Nginx
apt-get install nginx
nginx -v #查看nginx版本
service nginx start #啟動(dòng)nginx
service nginx restart #重啟nginx
service nginx stop #停止nginx
3)有ssl的配置文件
#配置nginx:
#配置注意:需要將靜態(tài)文件放入nginx目錄中,再進(jìn)入default目錄進(jìn)行修改
vim /etc/nginx/sites-enabled/default
#直接寫入default文件中
#server {
# listen 8002 default_server;
# listen [::]:8002 default_server;
#
# location / {
# root /home/alta_vue/;
# index index.html index.htm;
# }
#} #此處配ip和網(wǎng)絡(luò)配置
server {
listen 8002 default_server;
listen [::]:8002 default_server;
server_name 192.168.2.100; # 處理的host地址 (請(qǐng)?zhí)鎿Q成你對(duì)應(yīng)的項(xiàng)目訪問(wèn) ip 或 域名)!!!
root /home/alta_vue/; # vue項(xiàng)目存在的目錄(替換成你對(duì)應(yīng)的地址,如果你這是用docker部署的請(qǐng)改成你容器內(nèi)的地址)
location / {
try_files $uri $uri/ @router;#需要指向下面的@router否則會(huì)出現(xiàn)vue的路由在nginx中刷新出現(xiàn)404
index index.html index.htm;
}
location @router {
rewrite ^.*$ /index.html last;
}
access_log /var/log/nginx/access.log ;
}
#改完退出后重啟
service nginx restart
web點(diǎn)擊訪問(wèn)網(wǎng)址:http://192.168.2.100:8002/