微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐