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}
复制代码