Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # You may add here your
- # server {
- # ...
- # }
- # statements for each of your virtual hosts to this file
- ##
- # You should look at the following URL's in order to grasp a solid understanding
- # of Nginx configuration files in order to fully unleash the power of Nginx.
- # http://wiki.nginx.org/Pitfalls
- # http://wiki.nginx.org/QuickStart
- # http://wiki.nginx.org/Configuration
- #
- # Generally, you will want to move this file somewhere, and start with a clean
- # file but keep this around for reference. Or just disable in sites-enabled.
- #
- # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
- ##
- server {
- listen 80;
- server_name ptbi-enketo-test.globalhealthapp.net;
- # rewrite ^ https://<server-url>$request_uri? permanent;
- return 307 https://$server_name$request_uri;
- }
- server {
- #listen 80 default_server;
- #listen [::]:80 default_server ipv6only=on;
- listen 443 ssl;
- server_name ptbi-enketo-test.globalhealthapp.net;
- #root /home/dhis/tomcat-dhis/webapps/ROOT;
- client_max_body_size 100M;
- # Make site accessible from http://localhost/
- server_name localhost;
- ssl on;
- ssl_certificate /etc/nginx/ssl/server.crt;
- ssl_certificate_key /etc/nginx/ssl/server.key;
- ssl_session_cache shared:SSL:20m;
- ssl_session_timeout 10m;
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
- #ssl_ciphers RC4:HIGH:!aNULL:!MD5;
- ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA';
- ssl_prefer_server_ciphers on;
- add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
- # add_header Access-Control-Allow-Origin "https://ptbi-odk-test.globalhealthapp.net";
- add_header X-Content-Type-Options nosniff;
- ssl_stapling on;
- ssl_stapling_verify on;
- resolver 8.8.4.4 8.8.8.8 valid=300s;
- resolver_timeout 10s;
- # Serve static files
- #location ~ (\.js|\.css|\.gif|\.woff|\.ttf|\.eot|\.ico|(/dhis-web-commons/|/images/|/icons/).*\.png)$ {
- # add_header Cache-Control public;
- # expires 1d;
- #}
- # Proxy pass to servlet container
- location / {
- proxy_pass http://localhost:8005;
- proxy_redirect off;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto https;
- #more_set_headers Access-Control-Allow-Origin "https://ptbi-odk-test.globalhealthapp.net";
- proxy_buffer_size 128k;
- proxy_buffers 8 128k;
- proxy_busy_buffers_size 256k;
- if ($request_method = 'OPTIONS') {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- #
- # Custom headers and headers various browsers *should* be OK with but aren't
- #
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
- #
- # Tell client that this pre-flight info is valid for 20 days
- #
- add_header 'Access-Control-Max-Age' 1728000;
- add_header 'Content-Type' 'text/plain charset=UTF-8';
- add_header 'Content-Length' 0;
- return 204;
- }
- if ($request_method = 'POST') {
- add_header 'Access-Control-Allow-Origin' 'ptbi-odk-test.globalhealthapp.net';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,OpenRosa-Version';
- }
- if ($request_method = 'GET') {
- add_header 'Access-Control-Allow-Origin' 'ptbi-odk-test.globalhealthapp.net';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,OpenRosa-Version';
- }
- }
- #location / {
- # First attempt to serve request as file, then
- # as directory, then fall back to displaying a 404.
- # try_files $uri $uri/ =404;
- # Uncomment to enable naxsi on this location
- # include /etc/nginx/naxsi.rules
- #}
- # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
- #location /RequestDenied {
- # proxy_pass http://127.0.0.1:8080;
- #}
- #error_page 404 /404.html;
- # redirect server error pages to the static page /50x.html
- #
- #error_page 500 502 503 504 /50x.html;
- #location = /50x.html {
- # root /usr/share/nginx/html;
- #}
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
- #location ~ \.php$ {
- # fastcgi_split_path_info ^(.+\.php)(/.+)$;
- # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
- #
- # # With php5-cgi alone:
- # fastcgi_pass 127.0.0.1:9000;
- # # With php5-fpm:
- # fastcgi_pass unix:/var/run/php5-fpm.sock;
- # fastcgi_index index.php;
- # include fastcgi_params;
- #}
- # deny access to .htaccess files, if Apache's document root
- # concurs with nginx's one
- #
- #location ~ /\.ht {
- # deny all;
- #}
- }
- # another virtual host using mix of IP-, name-, and port-based configuration
- #
- #server {
- # listen 8000;
- # listen somename:8080;
- # server_name somename alias another.alias;
- # root html;
- # index index.html index.htm;
- #
- # location / {
- # try_files $uri $uri/ =404;
- # }
- #}
- # HTTPS server
- #
- #server {
- # listen 443;
- # server_name localhost;
- #
- # root html;
- # index index.html index.htm;
- #
- # ssl on;
- # ssl_certificate cert.pem;
- # ssl_certificate_key cert.key;
- #
- # ssl_session_timeout 5m;
- #
- # ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
- # ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
- # ssl_prefer_server_ciphers on;
- #
- # location / {
- # try_files $uri $uri/ =404;
- # }
- #}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement