1、官网下载稳定版nginx
我下载的版本是nginx-1.14.2.tar.gz
2、解压到/usr/local下
tar -zxvf nginx-1.14.2.tar.gz -C /usr/local/
3、编译安装nginx
cd /usr/local/nginx-1.14.2
yum -y install gcc gcc-c++ autoconf automake make
./configure --prefix=/usr/local/nginx
yum -y install openssl openssl-devel
# 还报错重新安装./configure --prefix=/usr/local/nginx
make && make install
4、启动nginx
cd /usr/local/nginx/sbin
./nginx
重启:
cd /usr/local/nginx/sbin && ./nginx -s reload
开机自启动nginx:
vim /etc/rc.local
添加:
/usr/local/nginx/sbin/nginx
测试nginx是否安装完成,访问:http://10.130.0.92/
配置nginx:/usr/local/nginx/conf/nginx.conf
#官网
server {
listen 9527;
server_name bs.jwell56.com;
charset utf-8;
location / {
root /opt/server/led_server/jwbs_facade;
index index.html index.htm;
}
}
#五联屏
server {
listen 8180;
server_name localhost;
charset utf-8;
location / {
root /opt/server/led_server/jwell56_led_server-1.0-SNAPSHOT/dist;
index transaction.html productionPage.html warehousePage.html mapPage.html loopPage.html;
}