Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

ProxyPass/ModProxy Issue

Discussion in 'EasyApache' started by zizizizz, Feb 21, 2018.

  1. zizizizz

    zizizizz Registered

    Joined:
    Feb 21, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    Dear Sir or Madam,

    Please excuse the likely blatantly obvious solution to this problem, but I have been speaking with server support for 4 days on how to get this working and they haven't been able to solve or even tell me how I am meant to fix this issue.

    Our server has cpanel/whm/easy_apache4 and has three domains that are currently being served by apache (They are have applications created under Create a New Account)
    sitea.com
    siteb.com
    sitec.com

    I have a docker image that is running a server (gunicorn/django) on localhost:8000 and have a fourth domain name that I want to make use of on the server. I have not created an account for it because it isn't serving files from public_html or anything like the other three.

    sited.com

    I was hoping apache would send traffic to localhost:8000 if the $host_name = sited.com
    so in WHM I have added this (below) to the pre_virtual_host in the Include Editor

    Home »Service Configuration »Apache Configuration »Include Editor
    Code:
    <VirtualHost *:80>
    
    ServerName www.sited.com
    ServerAlias sited.com
    
    # Let apache serve static files
    ProxyPreserveHost On
    ProxyPass /static/ !
    ProxyPass /media/ !
    Alias /static/ /home/app/static/
    Alias /media/ /home/app/media/
    
    # Gunicorn handle the others
    ProxyPass / http://localhost:8000/
    ProxyPassReverse / http://localhost:8000/
    
    </VirtualHost>
    
    But it never seems like Apache reads the file and the the url for sited.com never resolves. (curl localhost:8000 on the server has a 200 response) but going to it via sited.com just gives the
    "SORRY! If you are the owner of this website, please contact your hosting provider" message.

    Serving the application on a port other than 80 works too but is non-ideal and would rather have apache act as the reverse proxy.

    Are there additional steps to take?

    Thank you,

    zizizizz
     
    #1 zizizizz, Feb 21, 2018
    Last edited by a moderator: Feb 21, 2018
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,247
    Likes Received:
    1,759
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You can try setting up an account for the domain name on the cPanel server, and then implement a custom include file for it using the instructions at:

    Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation

    Ensure to run the following command after setting up the the custom include file:

    Code:
    /usr/local/cpanel/scripts/ensure_vhost_includes --all-users
    Additionally, I encourage you to vote for the following feature request if you'd like to see native support for Django offered in cPanel & WHM:

    Django support

    Thank you.
     
Loading...
Similar Threads - ProxyPass ModProxy Issue
  1. amanfredini
    Replies:
    1
    Views:
    731

Share This Page