nginx的安裝與配置

安裝

網上有不少是用yum安裝的,deepin中的apt就是yumnginx

使用apt在線安裝nginxapi

sudo apt -y install nginx
複製代碼

apt的默認安裝路徑

apt 安裝後文件安裝的默認路徑在哪裏bash

$ dpkg -L nginx 或者使用dpkg -S nginxspa

dpkg -L +軟件包的名字,能夠知道這個軟件包包含了哪些文件, 這個方法能夠列出全部安裝後留在系統裏的文件rest

系統安裝軟件通常在/usr/share,可執行的文件在/usr/bin,配置文件可能安裝到了/etc下等。code

文檔通常在 /usr/shareserver

可執行文件 /usr/bin文檔

配置文件 /etcio

lib文件 /usr/libclass

項目的配置

配置文件的路徑在/etc/nginx/nginx.conf,本項目添加的配置爲(具體的配置參考官網)

http {

	server {
		listen 8080;
		server_name localhost;

		location / {
			proxy_pass http://localhost:8001;
		}

		location /api/ {
			proxy_pass http://localhost:8000;
			proxy_set_header Host $host;
		}
	
	}
++++++++
++++++++
}
複製代碼

nginx的經常使用命令

service nginx + {start|stop|restart|reload|force-reload|status|configtest|rotate|upgrade}
複製代碼
相關文章
相關標籤/搜索