nginx
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| nginx [2024/05/27 08:51] – [Nginx] admin | nginx [2026/03/21 10:11] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Nginx ====== | ||
| + | |||
| + | Nginx is a fast HTTP server, generally faster than Apache, known for efficient request handling and minimal overhead. It's commonly used for serving static content. | ||
| + | |||
| + | A popular modern setup is the nginx\Apache combination. | ||
| + | |||
| + | Nginx (faster) handles all incoming connections and serves static content, while script requests forward to Apache. This approach significantly speeds things up when you serve both scripts and static content from the same server. | ||
| + | |||
| + | ===== Error 1 ===== | ||
| + | |||
| + | There' | ||
| + | |||
| + | You'll see this error: "Nginx <-> Apache ERROR $_SERVER[SERVER_ADDR] == $_SERVER[REMOTE_ADDR], | ||
| + | |||
| + | To fix it: Ask your admin to install the mod_realip module for Apache and configure nginx to pass the real IP in the X_REAL_IP header. | ||
| + | |||
| + | To verify: Open / | ||
| + | |||
| + | ===== Error 2 ===== | ||
| + | |||
| + | Another issue occurs when the visitor IP appears in both REAL_IP and HTTP_FORWARDED_FOR headers. | ||
| + | |||
| + | Check this: Open / | ||
| + | |||
| + | SmartCJ interprets HTTP_FORWARDED_FOR as a proxy indicator, so it incorrectly classifies all traffic as coming from proxies. | ||
| + | |||
| + | To fix: Ask your admin to ensure the IP is passed only in REAL_IP, not HTTP_FORWARDED_FOR. | ||
| + | |||
| + | To verify: Open / | ||
| + | - REMOTE_ADDR: | ||
| + | - REAL_IP: your actual IP | ||
| + | - SERVER_ADDR: | ||
| + | - HTTP_FORWARDED_FOR: | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | Result: if you open / | ||
| + | * REMOTE_ADDR - your IP | ||
| + | * SERVER_ADDR (SERVER_IP) - server IP | ||
| + | * HTTP_FORWARDED_FOR (or HTTP_X_FORWARDED_FOR) should not be present | ||
| + | |||
| + | |||
| + | |||
| + | ===== Admin password ===== | ||
| + | |||
| + | By default, admin access uses Apache' | ||
| + | |||
| + | **Option 1** - Enable " | ||
| + | |||
| + | **Option 2** - Ask your admin to add authentication rules to the nginx config: | ||
| + | |||
| + | < | ||
| + | |||
| + | location / | ||
| + | deny all; | ||
| + | } | ||
| + | |||
| + | location /scj/logs/ { | ||
| + | deny all; | ||
| + | } | ||
| + | |||
| + | location /scj/data/ { | ||
| + | deny all; | ||
| + | } | ||
| + | |||
| + | location / | ||
| + | deny all; | ||
| + | } | ||
| + | |||
| + | location /scj/admin/ { | ||
| + | auth_basic "Admin Zone"; | ||
| + | auth_basic_user_file / | ||
| + | } | ||
| + | |||
| + | location ~* / | ||
| + | index index.php; | ||
| + | auth_basic "Admin Zone"; | ||
| + | auth_basic_user_file / | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== Nginx password error ===== | ||
| + | |||
| + | Three password methods are available: | ||
| + | |||
| + | - **.htaccess** - An Apache config file. When you request a file from a directory with .htaccess, Apache reads it first. The admin panel uses Apache basic auth by default, which references a .htpasswd file. | ||
| + | - **Script-based (Option 2)** - scj/ | ||
| + | - **Nginx-based (Option 3)** - Nginx requests a password using .htpasswd (like the example above). | ||
| + | |||
| + | A common mistake is mixing methods: you set Option 3 (nginx password " | ||
| + | |||
| + | Solution: Use only one method. | ||
