A
A
Anton2018-01-31 06:12:55
Nginx
Anton, 2018-01-31 06:12:55

How to add port 8000 to nginx and make it available via ssl?

There is such a config
How to add port 8000 to it?
To get https://www.test.ru:8000

server {
  server_name test.ru www.test.ru;
  charset UTF-8;
  index index.html index.php;
  disable_symlinks if_not_owner from=$root_path;
  include /etc/nginx/vhosts-includes/*.conf;
  include /etc/nginx/vhosts-resources/test.ru/*.conf;
  access_log /var/www/httpd-logs/test.ru.access.log;
  error_log /var/www/httpd-logs/test.ru.error.log notice;
  ssi on;
  return 301 https://$host:443$request_uri;
  set $root_path /var/www/www-root/data/www/test.ru;
  root $root_path;
  listen 100.000.0.000:80;
  gzip on;
  gzip_comp_level 5;
  gzip_disable "msie6";
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
  location / {
    location ~ [^/]\.ph(p\d*|tml)$ {
      try_files /does_not_exists @php;
    }
  }
  location @php {
    fastcgi_index index.php;
    fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]";
    fastcgi_pass unix:/var/www/php-fpm/www-root.sock;
    fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
    try_files $uri =404;
    include fastcgi_params;
  }
}
server {
  server_name test www.test.ru;
  ssl on;
  ssl_certificate "/var/www/httpd-cert/www-root/test.ru_le2.crtca";
  ssl_certificate_key "/var/www/httpd-cert/www-root/test_le2.key";
  ssl_ciphers EECDHвырезано:!RC4;
  ssl_prefer_server_ciphers on;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
  charset UTF-8;
  index index.html index.php;
  disable_symlinks if_not_owner from=$root_path;
  include /etc/nginx/vhosts-includes/*.conf;
  include /etc/nginx/vhosts-resources/test.ru/*.conf;
  access_log /var/www/httpd-logs/test.ru.access.log;
  error_log /var/www/httpd-logs/test.ru.error.log notice;
  ssi on;
  set $root_path /var/www/www-root/data/www/test.ru;
  root $root_path;
  listen 100.000.0.000:443;
  gzip on;
  gzip_comp_level 5;
  gzip_disable "msie6";
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
  location / {
    location ~ [^/]\.ph(p\d*|tml)$ {
      try_files /does_not_exists @php;
    }
  }
  location @php {
    fastcgi_index index.php;
    fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]";
    fastcgi_pass unix:/var/www/php-fpm/www-root.sock;
    fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
    try_files $uri =404;
    include fastcgi_params;
  }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex McArrow, 2018-01-31
@anton99zel

If you need port 8080 with SSL and if it repeats the logic of what you have on port 443 - just copy the second section and serverreplace listen 100.000.0.000:443with listen in it .100.000.0.000:8080

T
Toopie, 2018-01-31
@Toopie

server_name test.ru www.test.ru ssl;
listen 8000;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question