Hi Andrew,

I've included below a full nginx + apache config for a development site
(which aside from NOT caching static assets because it's a dev site) is
similar to a production config.

A couple things to note which you may not use:

   - .well-known/acme-challenge/ has to do with Lets Encrypt SSL
   verification
   - All http requests are redirected to https
   - All requests with an extension (e.g. .png, .jpg, etc...) are served
   directly by nginx
   - All other requests (e.g. /user/detail) are proxied to apache
   - Apache assumes all requests are targeted for mod_wsgi

Let me know if you have any questions.

Other options in nginx can be used to tune buffering of request/response
bodies.


#######################################################################################################################################################

# Instance GiftHopper-2-dev-jason Main_nginx_conf Config

# Redirect http traffic to https://
server
{
  listen 192.168.2.241:80;
  server_name gifthopper.jason.dev.appcove.net;
  access_log
/home/jason/DevLevel.2/GiftHopper/Run/GiftHopper-2-dev-jason.nginx-access.log
main;

  location /.well-known/acme-challenge/ {root
/home/deploy/ServerDocumentRoot;}

  location /
  {
    return 302 https://$host$request_uri;
  }
}

server
{
  listen 192.168.2.241:443 ssl;

  server_name gifthopper.jason.dev.appcove.net;

  error_page 503 @maintenance;
  location @maintenance {
    root  /home/jason/DevLevel.2/GiftHopper/Web/Main;
    rewrite ^(.*)$ /ACRM2/503.html break;
  }

  ssl_certificate
/home/jason/DevLevel.2/GiftHopper/Run/file-hash-c7a8ce6fcedae1c5c2cc27b38d94e5e6589871e2.crt.pem;
  ssl_certificate_key
/home/jason/DevLevel.2/GiftHopper/Run/file-hash-f853a504461333a646ef9b263e8b6d05dc8d3f0d.key.pem;

  location /.well-known/acme-challenge/ {root
/home/deploy/ServerDocumentRoot;}

  access_log
/home/jason/DevLevel.2/GiftHopper/Run/GiftHopper-2-dev-jason.nginx-access.log
main;

  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-ConfKey 'Main_Domain';
  proxy_set_header Scheme $scheme;

  client_max_body_size 128m;

  root  /home/jason/DevLevel.2/GiftHopper/Web/Main;

  location ~ \.(py|pyc|pyo|wsgi)$
  {
    return 403;
  }

  location ~ \.([a-zA-Z0-9])+$
  {
    add_header Cache-Control 'no-cache, no-store, max-age=0,
must-revalidate';
    add_header Expires 'Thu, 01 Jan 1970 00:00:01 GMT';
  }

  # Handle .well-known stuff directly in nginx
  location /.well-known
  {
    add_header Cache-Control 'no-cache, no-store, max-age=0,
must-revalidate';
    add_header Expires 'Thu, 01 Jan 1970 00:00:01 GMT';
  }

  location /
  {
    # Never cache dynamic requests.
    add_header Cache-Control 'no-cache, no-store, max-age=0,
must-revalidate';
    add_header Expires 'Thu, 01 Jan 1970 00:00:01 GMT';
    proxy_pass http://127.0.0.1:60734;
  }

}

#######################################################################################################################################################

# Instance GiftHopper-2-dev-jason Async_httpd_conf Config
Listen 127.0.0.1:60735

# Async background process

<VirtualHost 127.0.0.1:60735>
  ServerName _default_;
  WSGIDaemonProcess async-60735 processes=1 threads=1
python-path=/home/jason/DevLevel.2/GiftHopper/Python:/home/jason/DevLevel.2/GiftHopper/PythonUserBase/lib/python3.6/site-packages
display-name=async-60735
  WSGIImportScript
/home/jason/DevLevel.2/GiftHopper/Async/wsgi_import_script.wsgi
process-group=async-60735 application-group=%{GLOBAL}
  ErrorLog
/home/jason/DevLevel.2/GiftHopper/Run/GiftHopper-2-dev-jason.Async.log
</VirtualHost>

# Instance GiftHopper-2-dev-jason WebProcess_httpd_conf Config

# Main WSGI Process
WSGIDaemonProcess GiftHopper-2-dev-jason-WebProcess processes=2 threads=2
python-path=/home/jason/DevLevel.2/GiftHopper/Python:/home/jason/DevLevel.2/GiftHopper/PythonUserBase/lib/python3.6/site-packages
display-name=wsgi-GiftHopper-2-dev-jason-WebProcess

# Instance GiftHopper-2-dev-jason Main_httpd_conf Config
<Directory "/home/jason/DevLevel.2/GiftHopper/Web/Main">
  AllowOverride None
  Require all granted
</Directory>

Listen 127.0.0.1:60734

<VirtualHost 127.0.0.1:60734>
  ServerName _default_
  DocumentRoot /home/jason/DevLevel.2/GiftHopper/Web/Main
  AddDefaultCharset UTF-8

  RewriteEngine on
  RewriteOptions inherit

  # Forbid any python source files from being served.
  RewriteRule \.(py|pyc|pyo|wsgi)$  -  [F]

  WSGIScriptAlias /API/V1
/home/jason/DevLevel.2/GiftHopper/Web/Main/API/V1/__init__.wsgi
  WSGIScriptAlias / /home/jason/DevLevel.2/GiftHopper/Web/Main/__init__.wsgi
  WSGIProcessGroup GiftHopper-2-dev-jason-WebProcess

  LogLevel info
  ErrorLog
/home/jason/DevLevel.2/GiftHopper/Run/GiftHopper-2-dev-jason.WebProcess.log
</VirtualHost>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/CAAHBju%2B6tCQzSfJEYx_BA%2Bj6JLa%3D%2Boj5oh%2BwRThyH7V%2BdemrzQ%40mail.gmail.com.

Reply via email to