title: editing nginx.conf file over cloud foundry
body: <p>I have an application built using django, angular and hosted using cloudfoundry. 
  partial URL with http fails to proceed, for example <a href="http://www.example.com/home" rel="nofollow noreferrer">http://www.example.com/home</a> will fail but <a href="https://www.example.com/home" rel="nofollow noreferrer">https://www.example.com/home</a> will work fine.</p>
  
  <p>same way <a href="http://www.example.com" rel="nofollow noreferrer">http://www.example.com</a> will redirect to <a href="https://www.example.com" rel="nofollow noreferrer">https://www.example.com</a> but when given with half URL the redirection is failing.</p>
  
  <p>So i did some research on this issue, and found that nginx.conf file needs to be edited and could not find more. is it need to be uploaded with the django application to cloud foundry </p>
  
  <p>any guide over this will be very helpful
  Out put of CF PUSH:</p>
  
  <pre><code>C:\***\dcms-api&gt;cf push -b https://github.com/cloudfoundry/nginx-buildpack.git
  Pushing from manifest to org DCMS / space Development as ***@***.com...
  Using manifest file C:\***\dcms-api\manifest.yml
  Getting app info...
  Updating app with these attributes...
    name:                dcms
    path:                C:\***\dcms-api
    buildpacks:
      https://github.com/cloudfoundry/nginx-buildpack.git
    disk quota:          512M
    health check type:   port
    instances:           1
    memory:              256M
    stack:               cflinuxfs3
    env:
      ACCEPT_EULA
      DB_HOST
      DB_NAME
      DB_PORT
      DB_USER
      DB_USER_PASSWORD
      SYS_NAME
      SYS_PASSWORD
    routes:
      dcms***.com
  
  Updating app dcms...
  Mapping routes...
  Comparing local files to remote cache...
  Packaging files to upload...
  Uploading files...
   385.10 KiB / 385.10 KiB [=====================================================================] 100.00% 1s
  
  Waiting for API to complete processing files...
  
  Staging app and tracing logs...
     Cell 9c6ffac8- creating container for instance eb1fe223-
     Cell 9c6ffac8- successfully created container for instance eb1fe223-
     Downloading app package...
     Downloading build artifacts cache...
     Downloaded app package (2M)
     Downloaded build artifacts cache (108M)
     -----&gt; Download go 1.12.4
     -----&gt; Running go build supply
     /tmp/buildpackdownloads/adf6125a52c1a65c9523985b5a87ec38 ~
     -----&gt; Nginx Buildpack version 1.1.9
     -----&gt; Supplying nginx
     -----&gt; No nginx version specified - using mainline =&gt; 1.17.10
     -----&gt; Installing nginx 1.17.10
            Download 
  
  
  
   [https://buildpacks.cloudfoundry.org/dependencies/nginx/nginx_1.17.10_linux_x64_cflinuxfs3_2fe87dae.tgz]
            **WARNING** nginx 1.17.x will no longer be available in new buildpacks released after 2020-05-01.
            See: https://nginx.org/
            **ERROR** nginx.conf file must be configured to respect the value of `{{port}}`
            **ERROR** Could not validate nginx.conf: no {{port}} in nginx.conf
     Failed to compile droplet: Failed to run all supply scripts: exit status 14
     Exit status 223
     Cell 9c6ffac8- stopping instance eb1fe223-
     Cell 9c6ffac8- destroying container for instance eb1fe223-
     Cell 9c6ffac8- successfully destroyed container for instance eb1fe223-
  Error staging application: App staging failed in the buildpack compile phase
  FAILED
  </code></pre>
  
  <p>and i have a doubt on where to place the following nginx.conf?</p>
  
  <p>nginx.conf:</p>
  
  <pre><code>worker_processes 1;
  daemon off;
  
  events { worker_connections 1024; }
  
  http {
    log_format cloudfoundry '$http_x_forwarded_for - $http_referer - [$time_local] "$request" $status $body_bytes_sent';
    default_type application/octet-stream;
    include mime.types;
    sendfile on;
    gzip on;
    tcp_nopush on;
    keepalive_timeout 30;
  
    server {
      listen 8080;
      server_name apps1-bg-int.icloud.intel.com .apps1-bg-int.icloud.intel.com;
  
      location / {
        root /home/vcap/app/static/UI;
        index index.html;
        proxy_redirect off;
  
        proxy_set_header   Host              $http_host;
        proxy_set_header   X-Real-IP         $remote_addr;
        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto https;
  
      }
    }
  }
  </code></pre>