Hi,
I'm running this same setup and it's making wonders.
eas wrote:
Let me know, I'd be happy to share my configs for frontending apache with nginx.
I would like to see yours if possible.
Here's mine running in ubuntu:
apache2.conf
Code:
Timeout 50
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 2
MaxSpareServers 2
MaxClients 10
MaxRequestsPerChild 1000
</IfModule>
nginx.conf
Code:
user www-data;
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
## General Options
server_tokens off;
sendfile on;
server_names_hash_bucket_size 64;
ignore_invalid_headers on;
limit_zone limit_per_ip $binary_remote_addr 1m;
## Timeouts
keepalive_timeout 10 10;
client_body_timeout 10;
client_header_timeout 10;
send_timeout 10;
## TCP options
tcp_nodelay on;
tcp_nopush on;
## GZip
gzip on;
gzip_buffers 16 8k;
gzip_comp_level 9;
gzip_http_version 1.0;
gzip_min_length 0;
gzip_proxied any;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript application/xml application/xml+rss application/x-httpd-php
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
# Upstream servers
upstream backend {
server 127.0.0.1:8080;
}
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
proxy.conf
Code:
proxy_pass http://backend;
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;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 32k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
nginx - example.com
Code:
server {
listen 80;
server_name example.com;
rewrite ^/(.*) http://www.example.com/$1 permanent;
}
server {
listen 80;
server_name www.example.com;
access_log off;
# Main location
location / {
include proxy.conf;
}
# Static files location
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
root /home/public_html/example.com/public;
}
}apache - example.com
Code:
<VirtualHost *:8080>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin mail@example.com
ServerName example.com
ServerAlias www.example.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/public_html/example.com/public
# Custom log file locations
LogLevel warn
ErrorLog /var/log/apache2/example.com-error.log
CustomLog /var/log/apache2/example.com-access.log combined
# RPAF proxy
RPAFenable On
RPAFsethostname On
RPAFproxy_ips 127.0.0.1
<Directory /home/public_html/example.com/public>
Options MultiViews Indexes Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>