0

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;
}

1 Answer 1

0

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
    }  

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.