user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; include /etc/nginx/conf.d/*.conf; server { listen 80; server_name 域名; rewrite ^/(.*) https://域名$1 permanent; #填写自己域名 } server #关键代码 { # SSL configuration listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; ssl_certificate /路径/*.pem; #你的ssl证书*.crt 或者 *.pem都可以 ssl_certificate_key /路径/*.key; #你的ssl key ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AES128:EECDH+aRSA+AES128:RSA+AES128:EECDH+ECDSA+AES256:EECDH+aRSA+AES256:RSA+AES256:EECDH+ECDSA+3DES:EECDH+aRSA+3DES:RSA+3DES:!MD5; #套件RSA和ecc不一样在下面我会分别给出 ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; root /usr/share/nginx/html; #网页路径,这里也可以放你们自己的html网站替换下就可以了 server_name 域名; #你的服务器域名 location /ray { #/ray 切记路径需要和v2ray服务器端和客户端保持一致 可自定义名字 proxy_redirect off; proxy_pass http://127.0.0.1:端口; #此IP地址和端口需要和v2ray服务器端配置保持一致, proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; } } }