T
T
time_is_always_against_us2017-03-16 23:20:42
Nginx
time_is_always_against_us, 2017-03-16 23:20:42

How to install SSL certificate on CentOS (Apache+NginX)?

The story is next. Successfully purchased an SSL certificate and started installing according to this manual on reg.ru. It ended up like this: Why doesn't Apache want to turn on (CentOS)? . The essence of that problem is multiple... The description on reg.ru is wonderful, understandable, but after its execution, Apache did not want to work. It turned out that port 443 was already occupied by NginX. I had to stop the mod_ssl module...
Having rummaged around on the Internet, I got the impression that ssl can be installed both through apache and through nginx + in that question Fixid wrote "ssl should probably be installed on nginx, since it sits on port 443". Well, I tried it according to another article on reg.ru. I did everything as described, but there was no result. Tried changing both /etc/nginx/nginx.conf and /etc/nginx/conf.d/ssl.conf.
And another moment. Initially, the server was configured through ispmanager. Now the trial is over, you have to do it manually, but the settings remain. Perhaps all the problems are due to this.
Just in case /etc/nginx/nginx.conf settings:

server {
  server_name мой_домен.ru www.мой_домен.ru;
  listen мой_ip;
  set $root_path /var/www/мой_домен.ru/data/www/мой_домен.ru;
  location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
    root $root_path;
    access_log /var/www/nginx-logs/мой_домен.ru isp;
    access_log /var/www/httpd-logs/мой_домен.ru.access.log ;
    error_page 404 = @fallback;
  }
  location / {
    proxy_pass http://мой_ip:81;
    proxy_redirect http://мой_ip:81/ /;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
  }
  location ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
    proxy_pass http://мой_ip:81;
    proxy_redirect http://мой_ip:81/ /;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
  }
  location @fallback {
    proxy_pass http://мой_ip:81;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
  }
  location ^~ /webstat/ {
    auth_basic "Restricted area";
    auth_basic_user_file /var/www/мой_домен.ru/data/etc/8782971.passwd;
    try_files $uri @fallback;
  }
  location ~* ^.+\.(gif|jpg|png|ico|html|htm|js|css|ttf)$ {
    root $root_path;
    access_log /var/www/nginx-logs/мой_домен.ru isp;
    access_log /var/www/httpd-logs/мой_домен.ru.access.log ;
    error_page 404 = @fallback;
  }
  include /usr/local/ispmgr/etc/nginx.inc;
  index index.php;
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question