1 # File /etc/nginx/sites-available/osrf-ws-http-proxy
3 # $ ln -s /etc/nginx/sites-available/osrf-ws-http-proxy \
4 # /etc/nginx/sites-enabled/osrf-ws-http-proxy
5 # $ sudo service nginx restart
7 # Assumes Apache is listening on HTTP=7080 and HTTPS=7443
9 # Example sending nginx logs to syslog
10 # error_log syslog:server=unix:/dev/log,nohostname;
11 # access_log syslog:server=unix:/dev/log,severity=info,nohostname combined;
17 # server_name domain.example.org
18 # return 301 https://domain.example.org$request_uri;
21 proxy_pass http://localhost:7080;
22 proxy_set_header Host $host;
23 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
24 proxy_set_header X-Forwarded-Proto $scheme;
25 proxy_read_timeout 300s;
32 # Use the same SSL certificate as Apache.
33 ssl_certificate /etc/apache2/ssl/server.crt;
34 ssl_certificate_key /etc/apache2/ssl/server.key;
36 # -----------------------------------------------------------------
37 # https://mozilla.github.io/server-side-tls/ssl-config-generator/
38 # generate with openssl dhparam -out /etc/apache2/ssl/dhparam.pem 2048
39 ssl_dhparam /etc/apache2/ssl/dhparam.pem;
40 ssl_session_timeout 1d;
41 ssl_session_cache shared:SSL:50m;
42 ssl_session_tickets off;
43 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
44 # Intermediate ciphers config / updated 2018-07-11
45 ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
46 ssl_prefer_server_ciphers on;
47 # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
48 add_header Strict-Transport-Security max-age=15768000;
50 # fetch OCSP records from URL in ssl_certificate and cache them
52 ssl_stapling_verify on;
53 # -----------------------------------------------------------------
56 proxy_pass https://localhost:7443;
57 proxy_set_header Host $host;
58 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
59 proxy_set_header X-Forwarded-Proto $scheme;
60 proxy_read_timeout 300s;
63 location /osrf-websocket-translator {
65 # websocketd may be run with or without SSL. When used with
66 # NGINX, the assumption is it runs w/o SSL. Change to taste.
67 proxy_pass http://localhost:7682;
69 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
71 # Needed for websockets proxying.
72 proxy_http_version 1.1;
73 proxy_set_header Upgrade $http_upgrade;
74 proxy_set_header Connection "upgrade";
76 # Disconnect the client if it takes this long to connect to
78 proxy_connect_timeout 1m;
80 # websocketd connections persist indefinitely. Leverage
81 # nginx timeouts to disconnect idle clients. Change
83 proxy_send_timeout 3m;
84 proxy_read_timeout 3m;