Created
August 15, 2018 08:39
-
-
Save kasunbg/55e4c18d491d2ba85baa8c9e877be144 to your computer and use it in GitHub Desktop.
Nginx configuration for Nexus Sonatype that apache maven built artifacts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listen *:80; | |
server_name maven.kasunbg.org; | |
access_log /var/log/nginx/maven.kasunbg.org/access.log; | |
error_log /var/log/nginx/maven.kasunbg.org/error.log; | |
# allow large uploads of files - refer to nginx documentation | |
client_max_body_size 3072m; | |
# optimize downloading files larger than 1G - refer to nginx doc before adjusting | |
proxy_max_temp_file_size 6144m; | |
# Protect against MIME sniffing vulnerabilities | |
add_header X-Content-Type-Options nosniff; | |
# Prevent Clickjacking Attack | |
add_header X-Frame-Options "SAMEORIGIN"; | |
# X-XSS Protection | |
add_header X-XSS-Protection "1; mode=block"; | |
## Nexus proxy tuneup | |
proxy_send_timeout 120; | |
proxy_read_timeout 300; | |
# proxy_connect_timeout 300; | |
proxy_buffering off; | |
# proxy_buffer_size 4k; | |
# Disable unwanted HTTP methods | |
if ($request_method !~ ^(GET|HEAD|POST|PUT|DELETE|CONNECT)$ ) | |
{ | |
return 444; | |
} | |
# Return all UI requests to HTTPS | |
if ($request_uri !~ "^/nexus/content*") { | |
return 301 https://$server_name$request_uri; | |
} | |
location /nexus { | |
proxy_pass http://localhost:8081/nexus; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment