一。安装nginx
# 彻底卸载nginx
apt-get --purge autoremove nginx
安装命令
sudo apt-get install nginx
#查看nginx的版本号
nginx -v
访问nginx
网页输入ip地址,访问成功,到此,nginx安装完毕
nginx服务器配置文件
/etc/nginx :Nginx配置目录。 所有的Nginx配置文件都驻留在这里。
/etc/nginx/nginx.conf :主要的Nginx配置文件。 这可以修改,以更改Nginx全局配置。
其中nginx.conf是主配置文件。Nginx.conf配置文件主要分成四个部分:
- main (全局设置) 。
- sever (虚拟主机设置)。
- upstream负载均街服务器设置。
- location(URL匹配特定位置的设置)。
listen 80; # 监听端口
server_name rrc.test.jiedaibao.com; # 允许域名
root /data/release/rrc/web; # 项目根目录
index index.php index.html index.htm; # 访问根文件
二.nginx的转发功能配置
修改/etc/nginx/nginx.conf下nginx.conf文件
# cd /etc/ngi