opensuse安装nginx
opensuse安装nginx
安装步骤如下
1、sudo zypper install curl ca-certificates gpg2
2、sudo zypper addrepo --gpgcheck --type yum --refresh --check \
'http://nginx.org/packages/sles/$releasever' nginx-stable
3、sudo zypper addrepo --gpgcheck --type yum --refresh --check \
'http://nginx.org/packages/mainline/sles/$releasever' nginx-mainline
4、curl -o /tmp/nginx_signing.key https://nginx.org/keys/nginx_signing.key
5、gpg --with-fingerprint /tmp/nginx_signing.key
6、pub 2048R/7BD9BF62 2011-08-19 [expires: 2024-06-14]
Key fingerprint = 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62
uid nginx signing key <signing-key@nginx.com>
7、sudo rpmkeys --import /tmp/nginx_signing.key
9、sudo zypper install nginx
配置nginx.conf,配置文件路径 /etc/nginx/nginx.conf
server {
# 监听80端口
listen 80;
# 服务器前端地址
server_name 255.255.255.0;
# 配置根地址:即访问ip地址,默认端口为80,映射到前端项目入口index.html
location / {
# 前端项目路径
root /home/vue/dist/;
# 前端项目入口
index index.html index.htm;
}
# 后端服务配置:地址是ip/vue映射到:localhost:8080
location /vue/ {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/;
}
}
nginx安装路径:/usr/local/nginx/sbin/nginx
启动命令路径:/usr/sbin/naginx
启动:/usr/sbin/nginx
停止:/usr/sbin/nginx -s stop
重新加载:/usr/sbin/nginx -s reload
有志之士,共同学习