Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7308271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T23:32:04+00:00 2026-05-28T23:32:04+00:00

I have a nginx server running with ssl enabled. Currently I have https enabled

  • 0

I have a nginx server running with ssl enabled.
Currently I have https enabled for all directories.
How enable ssl only for www.example.com/shop/* directory and disable for other??

here is my conf file :

    # Redirect everything to the main site.
server {
  server_name *.example.com;
  listen 80;
  ssl on;
  ssl_certificate /opt/nginx/conf/server.crt;
  ssl_certificate_key /opt/nginx/conf/server.key; 
  keepalive_timeout    70;

  access_log  /home/example/nginx_logs/access.log ;
  error_log  /home/example/nginx_logs/error.log ;

  root /home/example/public_html/example.com;   
  location ~ \.php$ {
      try_files $uri $uri/ /index.php?q=$uri&$args;         
      root          /home/example/public_html/example.com/;
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index  index.php;
      include        /opt/nginx/conf/fastcgi_params;
      #fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script;
      fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
      fastcgi_param  SCRIPT_FILENAME  /home/example/public_html/example.com$fastcgi_script_name;
      index  index.php index.html index.htm;   
  }

    if ($http_host != "example.com") {
        rewrite ^ http://example.com$request_uri permanent;
    }

    include global/restrictions.conf;

    # Additional rules go here.

    #Only include one of the files below.
    include global/wordpress.conf;
#   include global/wordpress-ms-subdir.conf;
#   include global/wordpress-ms-subdomain.conf;
}

tnanks,
D

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T23:32:05+00:00Added an answer on May 28, 2026 at 11:32 pm

    It is easy to achieve in Nginx. There are two steps involved in it.

    1. Port 443 will be used only when yourdomain.com/shop is accessed. All other requests would be redirected to port 80 (HTTP)
    2. Port 80 will check for yourdomain.com/shop. If found, it’d be redirected to port 443 (HTTPS).

    Here is a quick overview of how it could be done…

    server {
      listen 443;
      server_name yourdomain.com;
    
      # directives for SSL certificates
    
      # root, index, error_log, access_log directives
    
      location /shop {
        # directives to handle what's inside /shop, for example
        # try_files $uri $uri/ /index.php;
      }
    
      location ~ \.php$ {
        # directives to handle PHP files
      }
    
      # leave everything else to port 80
      location / {
        rewrite ^ http://$host$request_uri permanent;
      }
    }
    
    server {
      listen 80;
      server_name yourdomain.com;
    
      # root, index, error_log, access_log directives
    
      # redirect yourdomain.com/shop to port 443
      # Please put this before location / block as
      # nginx stops after seeing the first match
      location /shop {
        rewrite ^ https://$host$request_uri permanent;
      }
    
      location / {
        # directives to handle what's inside /, for example
        # try_files $uri $uri/ /index.php;
      }
    
      location ~ \.php$ {
        # directives to handle PHP files
      }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ubuntu server running nginx. I just tried to enable a vhost
I have a problem with my server redirecting http://www.mylesgray.com:8080/ -> http://www.mylesgray.com/ . Here are
I have a server running nginx + UWSGI + python. UWSGI is running as
I have running nginx on my server ansel.ms and a node.js app on ansel.ms:46156.
I currently have a CodeIgniter web app running on Ubuntu with nginx. I just
I have an NGINX server with fastcgi/PHP running on it. I need to add
I have multiple Django projects running on one server using gunicorn and nginx .
I'm running Ubuntu / nginx and php-fpm. When I open my website http://www.mydomain.com I
I have a running ejabberd installation, with http-bind enabled, nginx proxy, and a mini
I have URLs of the form http://domain/image/⟨uuid⟩/42x42/some_name.png . The Web server (nginx) is configured

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.