<VirtualHost 127.0.0.1:8080>
ServerName site.ru
ServerAlias *.site.ru
ServerSignature Off
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site\.ru [NC]
RewriteRule ^/(.*) http://www.site.ru/$1 [L,R]
ErrorDocument 404 /?error=404
ServerAdmin "info@site.ru"
ServerAdmin "info@site.ru"
AssignUserID site site
DocumentRoot /SOME_PATH/site/site.ru/www
VirtualDocumentRoot /SOME_PATH/site/site.ru/%1
CustomLog /var/log/apache2/site.ru.access.log combined
ErrorLog /var/log/apache2/site.ru.error.log
ServerSignature On
Options FollowSymLinks Includes MultiViews ExecCGI
UseCanonicalName Off
<IfModule mod_ssl.c>
SSLEngine off
</IfModule>
<Directory /SOME_PATH/site/site.ru/www>
Options +ExecCGI
AllowOverride All
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/SOME_PATH/site/site.ru/www/:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value memory_limit 128M
php_admin_value upload_max_filesize 128M
php_admin_value post_max_size 32M
php_admin_value open_basedir "/SOME_PATH/site/site.ru/www:/tmp"
</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.fcgi)>
SetHandler fcgid-script
Options +FollowSymLinks +ExecCGI
</Files>
</IfModule>
</Directory>
</VirtualHost>
RewriteCond %{HTTP_HOST} ^www\.site\.ru$ [NC]
RewriteRule ^(.*)$ http://site.ru/$1 [R=301,L]
netstat -nltp | grep 80
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 7079/apache2
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7007/nginx
server {
listen 80;
server_name site.ru www.site.ru;
root /SOME_PATH/site/site.ru/www;
access_log /var/log/nginx/site.ru.access.log;
error_log /var/log/nginx/site.ru.error.log info;
error_page 404 = @fallback;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
access_log /dev/null;
error_log /dev/null crit;
}
location @fallback {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
<VirtualHost 127.0.0.1:8080>
ServerName www.site.ru
Redirect / http://site.ru/
</VirtualHost>
<VirtualHost 127.0.0.1:8080>
ServerName site.ru
DocumentRoot /SOME_PATH/site/site.ru/www
...
</VirtualHost>
<VirtualHost 127.0.0.1:8080>
ServerName site.ru
ServerAlias *.site.ru
VirtualDocumentRoot /SOME_PATH/site/site.ru/%1
...
<VirtualHost 127.0.0.1:8080>
ServerName site.ru
ServerSignature Off
RewriteEngine on
ErrorDocument 404 /?error=404
ServerAdmin "info@site.ru"
ServerAdmin "info@site.ru"
AssignUserID site site
DocumentRoot /SOME_PATH/site/site.ru/www
CustomLog /var/log/apache2/site.ru.access.log combined
ErrorLog /var/log/apache2/site.ru.error.log
ServerSignature On
Options FollowSymLinks Includes MultiViews ExecCGI
UseCanonicalName Off
<IfModule mod_ssl.c>
SSLEngine off
</IfModule>
<Directory /SOME_PATH/site/site.ru/www>
Options +ExecCGI
AllowOverride All
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/SOME_PATH/site/site.ru/www/:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value memory_limit 128M
php_admin_value upload_max_filesize 128M
php_admin_value post_max_size 32M
php_admin_value open_basedir "/SOME_PATH/site/site.ru/www:/tmp"
</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.fcgi)>
SetHandler fcgid-script
Options +FollowSymLinks +ExecCGI
</Files>
</IfModule>
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.1:8080>
ServerName www.site.ru
ServerAlias *.site.ru
ServerSignature Off
RewriteEngine on
ErrorDocument 404 /?error=404
ServerAdmin "info@site.ru"
ServerAdmin "info@site.ru"
AssignUserID site site
DocumentRoot /SOME_PATH/site/site.ru/www
VirtualDocumentRoot /SOME_PATH/site/site.ru/%1
CustomLog /var/log/apache2/site.ru.access.log combined
ErrorLog /var/log/apache2/site.ru.error.log
ServerSignature On
Options FollowSymLinks Includes MultiViews ExecCGI
UseCanonicalName Off
<IfModule mod_ssl.c>
SSLEngine off
</IfModule>
<Directory /SOME_PATH/site/site.ru/www>
Options +ExecCGI
AllowOverride All
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/SOME_PATH/site/site.ru/www/:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value memory_limit 128M
php_admin_value upload_max_filesize 128M
php_admin_value post_max_size 32M
php_admin_value open_basedir "/SOME_PATH/site/site.ru/www:/tmp"
</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.fcgi)>
SetHandler fcgid-script
Options +FollowSymLinks +ExecCGI
</Files>
</IfModule>
</Directory>
</VirtualHost>
server {
listen 80;
server_name www.site.ru;
return 301 http://site.ru$request_uri;
}
server {
listen 80;
server_name site.ru;
root /SOME_PATH/site/site.ru/www;
access_log /var/log/nginx/site.ru.access.log;
error_log /var/log/nginx/site.ru.error.log info;
error_page 404 = @fallback;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
access_log /dev/null;
error_log /dev/null crit;
}
location @fallback {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}