中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

合肥個人建站模板廣東省疫情最新

合肥個人建站模板,廣東省疫情最新,中山小欖網站建設,徐匯網站制作安裝nginx 依次執(zhí)行以下兩條命令進行安裝: sudo apt-get update sudo apt-get install nginx通過查看版本號查看是否安裝成功: nginx -v補充卸載操作: sudo apt-get remove nginx nginx-common sudo apt-get purge nginx nginx-common su…

安裝nginx

依次執(zhí)行以下兩條命令進行安裝:

sudo apt-get update
sudo apt-get install nginx

通過查看版本號查看是否安裝成功:

nginx -v

補充卸載操作:

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

補充Ubuntu的包管理器的用法:

sudo apt-get update:更新軟件源
sudo apt-get upgrade:升級系統(tǒng)
sudo apt-get install package_name:安裝軟件包
sudo apt-get remove package_name:卸載軟件包
sudo apt-get autoremove:自動清除無用依賴項
sudo apt-get purge package_name:卸載軟件及其相關配置文件

nginx的配置文件

nginx的配置文件和靜態(tài)資源文件分布位置:

/usr/sbin/nginx:主程序
/etc/nginx:存放配置文件(nginx.conf)
/usr/share/nginx:存放靜態(tài)文件
/var/log/nginx:存放日志

本次實驗將配置文件放到/etc/nginx/configs下:
為了操作方便我將切換到了超級用戶:

sudo su
cd /etc/nginx
mkdir configs

最初的/etc/nginx目錄下的文件狀態(tài)如下:
在這里插入圖片描述
創(chuàng)建文件夾configs用于存放nginx的配置文件:
在這里插入圖片描述
配置文件相關注釋:
在這里插入圖片描述
以下是學習項目的一個配置:


#user  nobody;
worker_processes  1;#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {worker_connections  1024;
}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;map $http_upgrade $connection_upgrade{default upgrade;'' close;}upstream webservers{server 127.0.0.1:8080 weight=90 ;#server 127.0.0.1:8088 weight=10 ;}server {listen       80;server_name  localhost;#charset koi8-r;#access_log  logs/host.access.log  main;location / {root   html/sky;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;}# 反向代理,處理管理端發(fā)送的請求location /api/ {proxy_pass   http://localhost:8080/admin/;#proxy_pass   http://webservers/admin/;}# 反向代理,處理用戶端發(fā)送的請求location /user/ {proxy_pass   http://webservers/user/;}# WebSocketlocation /ws/ {proxy_pass   http://webservers/ws/;proxy_http_version 1.1;proxy_read_timeout 3600s;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "$connection_upgrade";}# 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;#    }#}}

創(chuàng)建并寫入配置文件:

cd configs
touch test.conf
gedit test.conf

將我們添加的配置導入到nginx的配置中:

cd /etc/nginx
vim nginx.conf

添加:include /etc/nginx/configs/*.conf;
在這里插入圖片描述

nginx相關命令

啟動:

systemctl start nginx

停止:

systemctl stop nginx

重啟:

systemctl reload nginx

查看nginx的啟停狀態(tài):(如果正常啟動,會看到綠色的Runing)

systemctl status nginx

如:
在這里插入圖片描述
訪問localhost(默認80端口)
在這里插入圖片描述

部署前端項目

我第二天重啟nginx的時候,發(fā)現(xiàn)它報錯如work_process,events相關的錯誤,應該是configs下的test.conf與/etc/nginx/nginx.conf中的內容發(fā)生了沖突,所以我直接將test.conf的內容(見上面)復制在nginx.conf中,才重啟成功。

路徑相關配置:在配置文件中將以下路徑改為你自己的打包好后的前端代碼所在路徑:

location / {root   /path/webcode;index  index.html index.htm;}

修改路徑后,重啟nginx。
按理說,這時我們訪問localhost的時候就會訪問前端代碼的index文件。但是我的是403 Forbidden。
我修改了以下兩個配置才能正常訪問:
一、使nginx的啟動用戶和nginx的工作用戶一致:
查看當前nginx的啟動用戶

ps aux|grep nginx

在這里插入圖片描述
發(fā)現(xiàn)nginx的工作用戶為nobody,所以再次修改配置文件中的啟動文件:
在這里插入圖片描述
再次查看:
在這里插入圖片描述
二、修改用戶對前端文件的訪問權限:

chmod -R 755 /path/webcode

在這里插入圖片描述
最后終于能正常訪問了,暫時就踩了這些坑,完美撒花~

http://www.risenshineclean.com/news/49923.html

相關文章:

  • 網站安裝步驟頁面電商入門基礎知識
  • 做網站通過什么掙錢如何做推廣宣傳
  • 做城通網盤資源網站的源碼關鍵詞app下載
  • 如何在網站上做用工登記天津百度seo
  • 沂南網站建設技能培訓網站
  • 杭州網站定制開發(fā)自助建站申請
  • 公司想建一個網站找誰做百度網頁版登錄
  • 男女怎樣做那個視頻網站百度推廣咨詢
  • 阿里云9元做網站營銷方法有哪些
  • 網站切圖誰來完成濟寧網站建設
  • 做分類網站用什么cms網推接單平臺
  • GPS實時定位網站怎么做抖音關鍵詞搜索排名
  • 那里做直播網站搜索引擎優(yōu)化指的是
  • 姓名域名亞馬遜seo什么意思
  • WordPress模版二次元長沙有實力seo優(yōu)化
  • 網站建設規(guī)劃北京今日重大新聞
  • 網站開發(fā)采購合同模板下載b2b
  • 做素材網站存儲搜索最多的關鍵詞的排名
  • 廣東網站建設微信官網開發(fā)網絡營銷策劃模板
  • 哪兒提供邢臺做網站windows系統(tǒng)優(yōu)化軟件排行榜
  • 一個公網ip可以做幾個網站青島官網seo方法
  • 怎么做網站企業(yè)文化欄目網站推廣途徑和推廣要點
  • 24小時學會網站建設 下載定制網站開發(fā)
  • 聯(lián)通做網站寧波seo網站推廣軟件
  • 網頁制作價格私活seodao cn
  • 商會網站建設方案廣告策劃公司
  • 商城類網站功能列表北京seo排名服務
  • 自己做時時彩票網站北京seo排名外包
  • 做網站小編怎么樣做網絡推廣可以通過哪些渠道推廣
  • 網站建設優(yōu)化公司cps推廣接單平臺