Skip to content

Added nginx#3

Open
shailesh271997 wants to merge 2 commits intoLondheShubham153:DevOpsfrom
shailesh271997:nginx-setup
Open

Added nginx#3
shailesh271997 wants to merge 2 commits intoLondheShubham153:DevOpsfrom
shailesh271997:nginx-setup

Conversation

@shailesh271997
Copy link

@shailesh271997 shailesh271997 commented Nov 14, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new Nginx service to enhance application routing.
    • Custom Nginx configuration for improved request handling and proxying to the main application.
  • Bug Fixes

    • Implemented health checks for the Nginx service to ensure reliability.
  • Documentation

    • Updated configuration files to reflect new service and routing capabilities.

@coderabbitai
Copy link

coderabbitai bot commented Nov 14, 2024

Walkthrough

The changes introduce a new nginx service in the docker-compose.yml file, configured to build from the ./nginx directory and expose port 80. It depends on the existing mainapp service and includes a health check for it. Additionally, a new Dockerfile for the nginx container is created, which copies a custom Nginx configuration file into the container. The configuration file establishes a server that proxies requests to the mainapp service at port 8080.

Changes

File Change Summary
docker-compose.yml Added new nginx service with build configuration, port mapping, restart policy, dependency on mainapp, and health check.
nginx/Dockerfile Created new Dockerfile to copy a custom Nginx configuration file into the container.
nginx/nginx.conf Added new Nginx configuration file with server settings, including event handling and request proxying to mainapp.

Poem

🐇 In the land of code where the rabbits play,
A new nginx hops in to brighten the day.
With ports all mapped and health checks in tow,
Our mainapp awaits, ready to grow!
So let’s cheer for changes, both big and small,
For in this code garden, there's room for us all! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Outside diff range and nitpick comments (1)
nginx/nginx.conf (1)

1-24: Improve configuration file formatting and documentation

The configuration file has inconsistent formatting and lacks documentation.

Consider these improvements:

  1. Use consistent indentation (preferably 4 spaces)
  2. Remove excessive empty lines
  3. Add comments to explain configuration blocks
  4. Group related directives together

Example structure:

# Worker processes and connections
worker_processes auto;
pid /var/run/nginx.pid;

# Event configuration
events {
    worker_connections 1024;
}

# HTTP server configuration
http {
    # ... (previous suggestions for http block) ...

    # Main server block
    server {
        listen 80;
        server_name localhost;

        # Proxy configuration for mainapp
        location / {
            # ... (previous suggestions for location block) ...
        }
    }
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d16279d and 5bef5a2.

📒 Files selected for processing (3)
  • docker-compose.yml (1 hunks)
  • nginx/Dockerfile (1 hunks)
  • nginx/nginx.conf (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • nginx/Dockerfile
🧰 Additional context used
🪛 yamllint
docker-compose.yml

[error] 48-48: trailing spaces

(trailing-spaces)


[warning] 51-51: too few spaces after comma

(commas)


[warning] 51-51: too few spaces after comma

(commas)


[warning] 51-51: too few spaces after comma

(commas)

🔇 Additional comments (3)
nginx/nginx.conf (1)

16-16: Verify mainapp service configuration

Ensure that the mainapp service is configured to listen on port 8080 as expected by this nginx configuration.

✅ Verification successful

Based on the shell script results, I can now generate the final response since I have sufficient information to verify the configuration alignment:

Port configuration is correctly aligned between nginx and mainapp service

The mainapp service configuration in docker-compose.yml confirms that:

  • The service is properly defined and networked
  • Health check explicitly verifies connectivity on port 8080
  • Both nginx and mainapp service configurations use the same port (8080)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check mainapp service configuration in docker-compose.yml
echo "Checking mainapp port configuration:"
rg -A 5 "mainapp:" 

# Check if there are any other nginx configurations that might conflict
echo -e "\nChecking for other nginx configurations:"
fd -t f "nginx.conf"

Length of output: 1188

docker-compose.yml (2)

55-56: Network configuration looks good

Correctly connected to the bankapp network, allowing communication with other services.


42-42: Request for additional files to review

The ./nginx directory should contain:

  1. Dockerfile - to verify the nginx image build
  2. nginx.conf - to review the proxy configuration, security headers, and rate limiting

Please add these files to the PR for a complete review.

#!/bin/bash
# Check if required files exist
fd -t f . -e conf -e Dockerfile --base-directory nginx

nginx/nginx.conf Outdated
Comment on lines 2 to 4
events{
worker_connections 1024;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add essential nginx directives for better process management

Consider adding these important directives at the top level:

+worker_processes auto;
+pid /var/run/nginx.pid;
+
 events {
     worker_connections 1024;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
events{
worker_connections 1024;
}
worker_processes auto;
pid /var/run/nginx.pid;
events{
worker_connections 1024;
}

nginx/nginx.conf Outdated
Comment on lines 15 to 21
location / {
proxy_pass http://mainapp:8080;
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 $scheme;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance proxy configuration with timeouts and buffering

The proxy configuration needs additional parameters for reliability and performance.

Apply these proxy optimizations:

     location / {
         proxy_pass http://mainapp:8080;
         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 $scheme;
+        
+        # Timeouts
+        proxy_connect_timeout 60s;
+        proxy_send_timeout 60s;
+        proxy_read_timeout 60s;
+        
+        # Buffering
+        proxy_buffering on;
+        proxy_buffer_size 4k;
+        proxy_buffers 4 32k;
+        proxy_busy_buffers_size 64k;
+        
+        # Basic rate limiting
+        limit_req zone=one burst=10 nodelay;
     }
+
+    # Define rate limiting zone
+    limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

Committable suggestion skipped: line range outside the PR's diff.

nginx/nginx.conf Outdated
Comment on lines 8 to 13
http{
server{
listen 80;

server_name localhost;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add security headers and HTTP-level optimizations

The configuration is missing several important security and performance directives.

Apply these security and performance improvements:

 http {
+    # Basic Settings
+    sendfile on;
+    tcp_nopush on;
+    tcp_nodelay on;
+    keepalive_timeout 65;
+    types_hash_max_size 2048;
+
+    # Security Headers
+    server_tokens off;
+    add_header X-Frame-Options "SAMEORIGIN";
+    add_header X-XSS-Protection "1; mode=block";
+    add_header X-Content-Type-Options "nosniff";
+
+    # MIME Types
+    include /etc/nginx/mime.types;
+    default_type application/octet-stream;
+
+    # Logging
+    access_log /var/log/nginx/access.log;
+    error_log /var/log/nginx/error.log;

     server {
         listen 80;
         server_name localhost;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
http{
server{
listen 80;
server_name localhost;
http {
# Basic Settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# Security Headers
server_tokens off;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
# MIME Types
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Logging
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server {
listen 80;
server_name localhost;

Comment on lines 42 to 44
build: ./nginx
image: nginx
container_name: nginx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Remove redundant image field

When using build, the image field is ignored. The image name will be derived from the project and service name.

  nginx:
    build: ./nginx
-   image: nginx
    container_name: nginx
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
build: ./nginx
image: nginx
container_name: nginx
build: ./nginx
container_name: nginx

Comment on lines 50 to 54
healthcheck:
test: ["CMD","curl","-f","http://mainapp:8080"]
interval: 30s
timeout: 10s
retries: 10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Revise health check configuration

Several issues with the current health check:

  1. It's checking mainapp instead of nginx itself
  2. The base nginx image might not have curl installed
  3. Command formatting issues
    healthcheck:
-     test: ["CMD","curl","-f","http://mainapp:8080"]
+     test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:80"]
      interval: 30s
      timeout: 10s
      retries: 10

The revised check:

  • Uses wget which is typically available in nginx images
  • Checks nginx's own HTTP endpoint
  • Fixes command formatting
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
healthcheck:
test: ["CMD","curl","-f","http://mainapp:8080"]
interval: 30s
timeout: 10s
retries: 10
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:80"]
interval: 30s
timeout: 10s
retries: 10
🧰 Tools
🪛 yamllint

[warning] 51-51: too few spaces after comma

(commas)


[warning] 51-51: too few spaces after comma

(commas)


[warning] 51-51: too few spaces after comma

(commas)

Comment on lines 47 to 49
restart: always
depends_on:
- mainapp
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance service dependency configuration

The current dependency will start nginx as soon as mainapp starts, without waiting for it to be healthy. Consider using condition:

    restart: always
    depends_on:
-     - mainapp
+     mainapp:
+       condition: service_healthy

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 yamllint

[error] 48-48: trailing spaces

(trailing-spaces)

Comment on lines +45 to +46
ports:
- "80:80"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Security measures needed for nginx reverse proxy

Based on the nginx configuration review:

  • No rate limiting is configured to protect against DoS attacks
  • No SSL/HTTPS configuration is present for encrypted communication
  • The configuration is very basic without security headers

Recommended changes:

  • Add rate limiting:
http {
    limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
    server {
        location / {
            limit_req zone=one burst=5;
            # existing proxy configuration...
        }
    }
}
  • Add security headers:
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
  • Consider adding SSL/HTTPS configuration for production environment
🔗 Analysis chain

Consider security implications of exposing port 80

Since you're exposing HTTP port directly to the host:

  1. Ensure proper rate limiting is configured in nginx.conf
  2. Consider using HTTPS (port 443) for production
  3. Verify if the port needs to be exposed globally or can be restricted to specific interfaces
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if nginx.conf has rate limiting configured
fd nginx.conf --exec grep -l "limit_req_zone" {} \;
# Check if SSL/HTTPS configuration exists
fd nginx.conf --exec grep -l "ssl_certificate" {} \;

Length of output: 161


Script:

#!/bin/bash
# Check nginx configuration files for rate limiting and SSL
fd -t f . -e conf --base-directory nginx -x cat {}

# Also check Dockerfile and docker-compose.yml for nginx configuration
fd "(Dockerfile|docker-compose.yml)" -x cat {}

Length of output: 2818

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (3)
docker-compose.yml (1)

41-45: Consider security and persistence configurations

While the basic setup looks good, consider these production-ready enhancements:

  1. For production environments, consider using HTTPS (port 443) instead of or alongside HTTP
  2. Add a named volume for nginx configuration persistence

Apply this diff to enhance the configuration:

  nginx:
    build: ./nginx
    container_name: nginx
    ports:
      - "80:80"
+     # - "443:443"  # Uncomment for HTTPS
+   volumes:
+     - nginx_config:/etc/nginx/conf.d

Add this to the bottom of the file:

volumes:
  nginx_config:
nginx/nginx.conf (2)

1-6: Add error log configuration at the main context level.

While the worker processes and events configuration is good, consider adding error log configuration at the main context level for better debugging capabilities.

 worker_processes auto;
 pid /var/run/nginx.pid;
+error_log /var/log/nginx/error.log warn;
 
 events {
     worker_connections 1024;

25-30: Optimize logging configuration.

Consider enhancing the logging configuration with a custom log format and log rotation.

     include /etc/nginx/mime.types;
     default_type application/octet-stream;

+    # Custom log format
+    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;
-    error_log /var/log/nginx/error.log;
+    access_log /var/log/nginx/access.log main buffer=16k;
+    error_log /var/log/nginx/error.log warn;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5bef5a2 and 0eb5ca6.

📒 Files selected for processing (2)
  • docker-compose.yml (1 hunks)
  • nginx/nginx.conf (1 hunks)
🧰 Additional context used
🪛 yamllint
docker-compose.yml

[error] 47-47: trailing spaces

(trailing-spaces)


[warning] 48-48: wrong indentation: expected 6 but found 7

(indentation)


[error] 48-48: trailing spaces

(trailing-spaces)

🔇 Additional comments (2)
docker-compose.yml (1)

54-55: LGTM!

The network configuration is correct, properly connecting the nginx service to the existing bankapp network.

nginx/nginx.conf (1)

32-58: 🛠️ Refactor suggestion

Add SSL configuration and health check endpoint.

Consider the following improvements:

  1. Add SSL configuration for secure communication
  2. Increase the rate limiting burst value
  3. Add a health check endpoint
     server {
-        listen 80;
+        listen 80 default_server;
+        listen 443 ssl http2 default_server;
         server_name localhost;
 
+        # SSL configuration
+        ssl_certificate /etc/nginx/ssl/server.crt;
+        ssl_certificate_key /etc/nginx/ssl/server.key;
+        ssl_session_timeout 1d;
+        ssl_session_cache shared:SSL:50m;
+        ssl_protocols TLSv1.2 TLSv1.3;
+        ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
+        ssl_prefer_server_ciphers off;
+
+        # Health check endpoint
+        location /health {
+            access_log off;
+            return 200 'healthy\n';
+        }
         
         location / {
-            limit_req zone=one burst=5;
+            limit_req zone=one burst=20 nodelay;

Run the following script to check if SSL certificates are present:

Comment on lines +46 to +48
restart: always
depends_on:
- mainapp
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Fix formatting issues and enhance dependency configuration

The current configuration has formatting issues and could benefit from enhanced dependency management.

Apply this diff to fix both:

    restart: always
-   depends_on: 
-      - mainapp 
+   depends_on:
+     mainapp:
+       condition: service_healthy
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
restart: always
depends_on:
- mainapp
restart: always
depends_on:
mainapp:
condition: service_healthy
🧰 Tools
🪛 yamllint

[error] 47-47: trailing spaces

(trailing-spaces)


[warning] 48-48: wrong indentation: expected 6 but found 7

(indentation)


[error] 48-48: trailing spaces

(trailing-spaces)

Comment on lines +20 to +22
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance security with additional headers.

Consider adding more security headers to improve the application's security posture.

     add_header X-Frame-Options "SAMEORIGIN";
     add_header X-XSS-Protection "1; mode=block";
     add_header X-Content-Type-Options "nosniff";
+    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
+    add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';" always;
+    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;

Comment on lines +8 to +17
http {

limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;


sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Optimize rate limiting and enable compression.

The current rate limiting of 1 request per second might be too restrictive for production use. Also, enabling gzip compression could significantly improve performance.

 http {
     
-    limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
+    limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;

     sendfile on;
     tcp_nopush on;
     tcp_nodelay on;
     keepalive_timeout 65;
     types_hash_max_size 2048;
+    
+    # Enable compression
+    gzip on;
+    gzip_vary on;
+    gzip_proxied any;
+    gzip_comp_level 6;
+    gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
http {
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
http {
limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# Enable compression
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant