PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, September 21, 2022

[FIXED] How to make Digital Access Pass sub directory (.../dap) to use http onn nginx web server, OS: Ubuntu?

 September 21, 2022     nginx, ssl, ubuntu-14.04, virtualhost     No comments   

Issue

I have nginx web server installed and https domain. I want to make a sub-directory /dap in root folder to use http and exclude from ssl. Please guide me through this.

My /etc/nginx/sites-available virtual host file for this domain is as below,

# WPSINGLE FAST CGI NGINX CONFIGURATION
server {
    listen 198.27.70.206:80;
    server_name howtofightnow.com;
        return 301 https://howtofightnow.com$request_uri;
}

server {
        listen   443 ssl;
        server_name howtofightnow.com;
        ssl    on;
        ssl_certificate    /etc/nginx/ssl/howtofightnow_com.pem;
        ssl_certificate_key    /etc/nginx/ssl/server.key;
    #listen 198.27.70.206:80;
    #server_name howtofightnow.com; 

    access_log   /var/log/nginx/howtofightnow.com.access.log rt_cache;
    error_log    /var/log/nginx/howtofightnow.com.error.log;

    root /var/www/howtofightnow.com/htdocs;
    index index.php index.htm index.html;

        location /zabbix {
            if ($scheme ~ ^http:){
                rewrite ^(.*)$  https://$host$1 permanent;
            }
        alias           /usr/share/zabbix;
        index           index.php;
        error_page      403 404 502 503 504  /zabbix/index.php;

        location ~ \.php$ {
            if (!-f $request_filename) { return 404; }
            expires     epoch;
            include     fastcgi_params;
            fastcgi_index   index.php;
            fastcgi_pass    php;
            }
        location ~ \.(jpg|jpeg|gif|png|ico)$ {
            access_log  off;
            expires     33d;
        }
    }

    # Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress
    location / {
        try_files $uri $uri/ /index.php?$args;
    }


    location ~ .php$ {
        try_files $uri /index.php?args;
        include fastcgi_params;
        fastcgi_pass php;

    }

    location /vma {
          root /usr/local/vimbadmin/public ;
          try_files $uri $uri/ /index.php?$args;


                location ~ .php$ {
                try_files $uri =404;
                include fastcgi_params;
                fastcgi_pass php;

                }

    }
    rewrite ^/index.php/register/thanks(.*) /register/thanks$1  permanent;
    include /etc/nginx/common/locations.conf;
}

Solution

Simply add this location (/dap) to your http server section, plus add a separate root location, as following:

server {
    listen 198.27.70.206:80;
    server_name howtofightnow.com;

    location / {
      return 301 https://howtofightnow.com$request_uri;
    }

    location /dap/ {
      # specific rules for this location go here
    }  

}


Answered By - taleodor
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing