美文网首页
Nginx Installation and Configura

Nginx Installation and Configura

作者: 曲元洪 | 来源:发表于2019-06-14 15:56 被阅读0次

Environment: CentOS 7.5

  1. install the dependencies
yum install openssl
yum install zlib
yum install pcre
  1. install nginx repository
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
  1. install nginx
yum install nginx
  1. start nginx
sudo systemctl start nginx
  1. nginx can be visited via http://youripaddress
  2. the default port is 80. it can be modified by editing the file under /etc/nginx/conf.d/default.conf

Https configuration

  1. open file under /etc/nginx/conf.d/default.conf
  2. edit the file, add the code below to the bottom of the file
server {
    listen              443 ssl;
    server_name         www.example.com;
    ssl_certificate     www.example.com.crt;
    ssl_certificate_key www.example.com.key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
}
  1. restart nginx service
sudo systemctl restart nginx
  1. visit https://youripaddress

Configure reverse proxy

  1. edit the file under /etc/nginx/conf.d/default.conf
location /subdomain {
        proxy_pass https://youripaddress:port/subdomain
}
2. restart nginx service



相关文章

网友评论

      本文标题:Nginx Installation and Configura

      本文链接:https://www.haomeiwen.com/subject/pngufctx.html