Nginx + Apache - what is the correct admin config to stop /var/www
Posted: Sun Jun 04, 2017 4:07 am
I have struggled with this from day one and for the life of me have not managed to get this working at all.
The nginx.conf looks like this on the admin account:
The snginx.conf
The apache configs are defaults and all set /home/admin/web/marketers.coop/public_html correctly.
The problem I am having is that the https site works flawlessly, but the http site seems to be looking to /var/www/ instead of /home/admin/web/marketers.coop/. I tried creating a symlink between the directories but that creates a 500 error for some reason.
My site heavily relies on both http and https and they need to be able to pass sessions back and forth between the two (yes I know the security issues with this) so the files cannot be stored in two different locations, or the url's will be treated as completely different and the sessions passed between them will not maintain any variables.
Why is this defaulting the admin http account to /var/www but not the https? Is there an easy solution to this other than to install the site under a user account?
The nginx.conf looks like this on the admin account:
Code: Select all
server {
listen 192.227.210.138:80;
server_name marketers.coop www.marketers.coop *.marketers.coop;
error_log /var/log/apache2/domains/marketers.coop.error.log error;
location / {
proxy_pass http://192.227.210.138:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/marketers.coop/public_html;
access_log /var/log/apache2/domains/marketers.coop.log combined;
access_log /var/log/apache2/domains/marketers.coop.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/marketers.coop/document_errors/;
}
location @fallback {
proxy_pass http://192.227.210.138:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.marketers.coop.conf*;
}
Code: Select all
server {
listen 192.227.210.138:443;
server_name marketers.coop www.marketers.coop *.marketers.coop;
ssl on;
ssl_certificate /home/admin/conf/web/ssl.marketers.coop.pem;
ssl_certificate_key /home/admin/conf/web/ssl.marketers.coop.key;
error_log /var/log/apache2/domains/marketers.coop.error.log error;
location / {
proxy_pass https://192.227.210.138:8443;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/marketers.coop/public_html;
access_log /var/log/apache2/domains/marketers.coop.log combined;
access_log /var/log/apache2/domains/marketers.coop.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/marketers.coop/document_errors/;
}
location @fallback {
proxy_pass https://192.227.210.138:8443;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/snginx.marketers.coop.conf*;
}
The problem I am having is that the https site works flawlessly, but the http site seems to be looking to /var/www/ instead of /home/admin/web/marketers.coop/. I tried creating a symlink between the directories but that creates a 500 error for some reason.
My site heavily relies on both http and https and they need to be able to pass sessions back and forth between the two (yes I know the security issues with this) so the files cannot be stored in two different locations, or the url's will be treated as completely different and the sessions passed between them will not maintain any variables.
Why is this defaulting the admin http account to /var/www but not the https? Is there an easy solution to this other than to install the site under a user account?