Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

Nginx + Apache - what is the correct admin config to stop /var/www

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
2 posts • Page 1 of 1
viraladmin
Posts: 57
Joined: Thu Apr 27, 2017 7:40 pm

Os: Ubuntu 15x
Web: apache + nginx
Nginx + Apache - what is the correct admin config to stop /var/www
  • Quote

Post by viraladmin » 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:

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*;
}
    
The snginx.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 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?
Top

viraladmin
Posts: 57
Joined: Thu Apr 27, 2017 7:40 pm

Os: Ubuntu 15x
Web: apache + nginx
Re: Nginx + Apache - what is the correct admin config to stop /var/www
  • Quote

Post by viraladmin » Sun Jun 04, 2017 6:30 pm

I finally found out the problem and I hope this helps others who may make the same mistake as I did.

So I was learning about tweaking the settings of nginx for performance reasons, and I changed some config files, specifically the caching pool.

I had changed the levels from 2 to 1,2 in /etc/nginx/conf.d/01_caching_pool.conf which created the issue.
Top


Post Reply
  • Print view

2 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password