标签 - web

nginx web ssl https    2021-08-23 11:46:54    15    0    0

对我来说nginx就是两个作用,(1)当个WEB服务器用(2)给其它WEB应用走https

一、用docker安装nginx

  1. docker pull nginx
  2. docker run -it -d --name mynginx --privileged --net=host nginx

二、配置nginx.conf

  1. user nginx;
  2. worker_processes auto;
  3. error_log /var/log/nginx/error.log notice;
  4. pid /var/run/nginx.pid;
  5. events {
  6. worker_connections 1024;
  7. }
  8. http {
  9. include /etc/nginx/mime.types;
  10. default_type application/octet-stream;
  11. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  12. '$status $body_bytes_sent "$http_referer" '
  13. '"$http_user_agent" "$http_x_forwarded_for"';
  14. access_log /var/log/nginx/access.log main;
  15. sendfile on;
  16. #tcp_nopush on;
  17. keepalive_timeout 65;
  18. #gzip on;
  19. include /etc/nginx/conf.d/*.conf;
  20. server {
  21. listen 443 ssl;
  22. server_name 13ua.com;
  23. ssl on;
  24. ssl_certificate /usr/share/nginx/html/13