Convert nginx conf file to apache

Hi!

I’m trying to port an conf file from Nginx to Apache. Right now I’m running an python application with Nginx and Gunicorn, but I would like to use Apache instead of Nginx.

server_names_hash_bucket_size 64;

upstream frappe {
            server 127.0.0.1:8000 fail_timeout=0;
}

server {
            listen 80  default ;
            client_max_body_size 4G;
            server_name frappe_default_site;

            keepalive_timeout 5;
            sendfile on;
            root /home/ubuntu/frappe-bench/sites;

            location /private/ {
                    internal;
                    try_files /$uri =424;
            }

            location /assets {
                    try_files $uri =404;
            }

            location / {
                    try_files /erpnext/public/$uri @magic;
            }

            location @magic {
                    proxy_set_header X-Forwarded-For     $proxy_add_x_forwarded_for;
                    proxy_set_header X-Frappe-Site-Name erpnext;
                    proxy_set_header Host $host;
                    proxy_set_header X-Use-X-Accel-Redirect True;
                    proxy_read_timeout 120;
                    proxy_redirect off;
                    proxy_pass  http://frappe;
            }
}

And this is what I have:

<VirtualHost *:80>
   ServerName local.co
   ServerAlias www.local.co
   DocumentRoot "/home/ubuntu/frappe-bench/sites/"

   ProxyPass / http://127.0.0.1:8000/
   ProxyPassReverse / http://127.0.0.1:8000/
</VirtualHost>

<VirtualHost *:443>
   ServerName local.co
   ServerAlias www.local.co
   DocumentRoot "/home/ubuntu/frappe-bench/sites"

   ProxyPass / http://127.0.0.1:8000/
   ProxyPassReverse / http://127.0.0.1:8000/
</VirtualHost>

Can anyone help me? Thanks a lot.

Hi Lsa,

Please consider following config file,

<VirtualHost *:80>
ServerName consultation.indictranstech.com
DocumentRoot /
UseCanonicalName Off
ErrorLog /var/log/apache2/error.log
          # Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined

<Directory />
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

ProxyPreserveHost On
<Location />
          ProxyPass http://IP:Port/
          ProxyPassReverse IP:Port/
</Location>
          <Proxy http://IP:Port/>
    AllowOverride None
    Order allow,deny
    Allow from All
</Proxy>

Regards,
Saurabh
New Indictranstech Pvt Ltd

Hi @saurabh6790

Thank you so much.

Convert this;

Note: This file must be loaded before other virtual host config files,

HTTPS

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name tepmail.tk www.tepmail.tk;

root /var/www/html;
index index.php index.html;

include /etc/nginx/templates/misc.tmpl;
include /etc/nginx/templates/ssl.tmpl;
include /etc/nginx/templates/iredadmin.tmpl;
include /etc/nginx/templates/roundcube.tmpl;
include /etc/nginx/templates/sogo.tmpl;
include /etc/nginx/templates/netdata.tmpl;
include /etc/nginx/templates/php-catchall.tmpl;
include /etc/nginx/templates/stub_status.tmpl;
}