reason of using Location and Directory for the same objects in Apache











up vote
1
down vote

favorite












as per my understanding in Apache Directory directives refer to file system objects , Location refer to element in the request URI. So if the URI matches the objects in file system, why to use Directory and Location interchangeably ?



ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/"
Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/"

<IfModule mod_perl.c>

# Setup environment and preload modules
Perlrequire /opt/otrs/scripts/apache2-perl-startup.pl

# Reload Perl modules when changed on disk
PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload

# general mod_perl2 options
<Location /otrs>
# ErrorDocument 403 /otrs/customer.pl
ErrorDocument 403 /otrs/index.pl
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
Options +ExecCGI
PerlOptions +ParseHeaders
PerlOptions +SetupEnv

<IfModule mod_version.c>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</IfModule>
<IfModule !mod_version.c>
Order allow,deny
Allow from all
</IfModule>
</Location>

# mod_perl2 options for GenericInterface
<Location /otrs/nph-genericinterface.pl>
PerlOptions -ParseHeaders
</Location>

</IfModule>

<Directory "/opt/otrs/bin/cgi-bin/">
<Directory "/opt/otrs/bin/cgi-bin/">
AllowOverride None
Options +ExecCGI -Includes

<IfModule mod_version.c>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</IfModule>
<IfModule !mod_version.c>
Order allow,deny
Allow from all
</IfModule>

<IfModule mod_filter.c>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/javascript application/javascript text/css text/xml application/json text/json
</IfModule>
</IfModule>

</Directory>


EDIT:



Thank you. Here’s how I understand but please feel free to correct me. I’m here to learn from my mistakes 
ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/" designates the target directory for CGI programs.



In /opt/otrs/bin/cgi-bin/ I have the following content:



drwxrwsr-x 4 otrs apache  205 Nov 13 16:39 ..
drwxrwsr-x 2 otrs apache 139 Oct 22 09:27 .
-rwxrwx--- 1 otrs apache 3.4K Sep 28 01:40 app.psgi
-rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 customer.pl
-rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 index.pl
-rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 installer.pl
-rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 nph-genericinterface.pl
-rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 public.pl
-rwxrwx--- 1 otrs apache 7.2K Sep 28 01:40 rpc.pl


So as per my understanding if I call https://ipv4/otrs/index.pl it will trigger that particular script located under /opt/otrs/bin/cgi-bin/



So with the section all the scripts under "/opt/otrs/bin/cgi-bin/" will have the options between <Location /otrs> </Location> applied. If I access https://ipv4/otrs/nph-genericinterface.pl the options from the section <Location /otrs> </Location> will be merged along with the options set within <Location /otrs/nph-genericinterface.pl> </Location>



But then I have the same content defined under <Directory "/opt/otrs/bin/cgi-bin/">



What is the reason for this ? Aren't both directives referring to exactly the same thing ?










share|improve this question




























    up vote
    1
    down vote

    favorite












    as per my understanding in Apache Directory directives refer to file system objects , Location refer to element in the request URI. So if the URI matches the objects in file system, why to use Directory and Location interchangeably ?



    ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/"
    Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/"

    <IfModule mod_perl.c>

    # Setup environment and preload modules
    Perlrequire /opt/otrs/scripts/apache2-perl-startup.pl

    # Reload Perl modules when changed on disk
    PerlModule Apache2::Reload
    PerlInitHandler Apache2::Reload

    # general mod_perl2 options
    <Location /otrs>
    # ErrorDocument 403 /otrs/customer.pl
    ErrorDocument 403 /otrs/index.pl
    SetHandler perl-script
    PerlResponseHandler ModPerl::Registry
    Options +ExecCGI
    PerlOptions +ParseHeaders
    PerlOptions +SetupEnv

    <IfModule mod_version.c>
    <IfVersion < 2.4>
    Order allow,deny
    Allow from all
    </IfVersion>
    <IfVersion >= 2.4>
    Require all granted
    </IfVersion>
    </IfModule>
    <IfModule !mod_version.c>
    Order allow,deny
    Allow from all
    </IfModule>
    </Location>

    # mod_perl2 options for GenericInterface
    <Location /otrs/nph-genericinterface.pl>
    PerlOptions -ParseHeaders
    </Location>

    </IfModule>

    <Directory "/opt/otrs/bin/cgi-bin/">
    <Directory "/opt/otrs/bin/cgi-bin/">
    AllowOverride None
    Options +ExecCGI -Includes

    <IfModule mod_version.c>
    <IfVersion < 2.4>
    Order allow,deny
    Allow from all
    </IfVersion>
    <IfVersion >= 2.4>
    Require all granted
    </IfVersion>
    </IfModule>
    <IfModule !mod_version.c>
    Order allow,deny
    Allow from all
    </IfModule>

    <IfModule mod_filter.c>
    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/javascript application/javascript text/css text/xml application/json text/json
    </IfModule>
    </IfModule>

    </Directory>


    EDIT:



    Thank you. Here’s how I understand but please feel free to correct me. I’m here to learn from my mistakes 
    ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/" designates the target directory for CGI programs.



    In /opt/otrs/bin/cgi-bin/ I have the following content:



    drwxrwsr-x 4 otrs apache  205 Nov 13 16:39 ..
    drwxrwsr-x 2 otrs apache 139 Oct 22 09:27 .
    -rwxrwx--- 1 otrs apache 3.4K Sep 28 01:40 app.psgi
    -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 customer.pl
    -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 index.pl
    -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 installer.pl
    -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 nph-genericinterface.pl
    -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 public.pl
    -rwxrwx--- 1 otrs apache 7.2K Sep 28 01:40 rpc.pl


    So as per my understanding if I call https://ipv4/otrs/index.pl it will trigger that particular script located under /opt/otrs/bin/cgi-bin/



    So with the section all the scripts under "/opt/otrs/bin/cgi-bin/" will have the options between <Location /otrs> </Location> applied. If I access https://ipv4/otrs/nph-genericinterface.pl the options from the section <Location /otrs> </Location> will be merged along with the options set within <Location /otrs/nph-genericinterface.pl> </Location>



    But then I have the same content defined under <Directory "/opt/otrs/bin/cgi-bin/">



    What is the reason for this ? Aren't both directives referring to exactly the same thing ?










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      as per my understanding in Apache Directory directives refer to file system objects , Location refer to element in the request URI. So if the URI matches the objects in file system, why to use Directory and Location interchangeably ?



      ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/"
      Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/"

      <IfModule mod_perl.c>

      # Setup environment and preload modules
      Perlrequire /opt/otrs/scripts/apache2-perl-startup.pl

      # Reload Perl modules when changed on disk
      PerlModule Apache2::Reload
      PerlInitHandler Apache2::Reload

      # general mod_perl2 options
      <Location /otrs>
      # ErrorDocument 403 /otrs/customer.pl
      ErrorDocument 403 /otrs/index.pl
      SetHandler perl-script
      PerlResponseHandler ModPerl::Registry
      Options +ExecCGI
      PerlOptions +ParseHeaders
      PerlOptions +SetupEnv

      <IfModule mod_version.c>
      <IfVersion < 2.4>
      Order allow,deny
      Allow from all
      </IfVersion>
      <IfVersion >= 2.4>
      Require all granted
      </IfVersion>
      </IfModule>
      <IfModule !mod_version.c>
      Order allow,deny
      Allow from all
      </IfModule>
      </Location>

      # mod_perl2 options for GenericInterface
      <Location /otrs/nph-genericinterface.pl>
      PerlOptions -ParseHeaders
      </Location>

      </IfModule>

      <Directory "/opt/otrs/bin/cgi-bin/">
      <Directory "/opt/otrs/bin/cgi-bin/">
      AllowOverride None
      Options +ExecCGI -Includes

      <IfModule mod_version.c>
      <IfVersion < 2.4>
      Order allow,deny
      Allow from all
      </IfVersion>
      <IfVersion >= 2.4>
      Require all granted
      </IfVersion>
      </IfModule>
      <IfModule !mod_version.c>
      Order allow,deny
      Allow from all
      </IfModule>

      <IfModule mod_filter.c>
      <IfModule mod_deflate.c>
      AddOutputFilterByType DEFLATE text/html text/javascript application/javascript text/css text/xml application/json text/json
      </IfModule>
      </IfModule>

      </Directory>


      EDIT:



      Thank you. Here’s how I understand but please feel free to correct me. I’m here to learn from my mistakes 
      ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/" designates the target directory for CGI programs.



      In /opt/otrs/bin/cgi-bin/ I have the following content:



      drwxrwsr-x 4 otrs apache  205 Nov 13 16:39 ..
      drwxrwsr-x 2 otrs apache 139 Oct 22 09:27 .
      -rwxrwx--- 1 otrs apache 3.4K Sep 28 01:40 app.psgi
      -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 customer.pl
      -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 index.pl
      -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 installer.pl
      -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 nph-genericinterface.pl
      -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 public.pl
      -rwxrwx--- 1 otrs apache 7.2K Sep 28 01:40 rpc.pl


      So as per my understanding if I call https://ipv4/otrs/index.pl it will trigger that particular script located under /opt/otrs/bin/cgi-bin/



      So with the section all the scripts under "/opt/otrs/bin/cgi-bin/" will have the options between <Location /otrs> </Location> applied. If I access https://ipv4/otrs/nph-genericinterface.pl the options from the section <Location /otrs> </Location> will be merged along with the options set within <Location /otrs/nph-genericinterface.pl> </Location>



      But then I have the same content defined under <Directory "/opt/otrs/bin/cgi-bin/">



      What is the reason for this ? Aren't both directives referring to exactly the same thing ?










      share|improve this question















      as per my understanding in Apache Directory directives refer to file system objects , Location refer to element in the request URI. So if the URI matches the objects in file system, why to use Directory and Location interchangeably ?



      ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/"
      Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/"

      <IfModule mod_perl.c>

      # Setup environment and preload modules
      Perlrequire /opt/otrs/scripts/apache2-perl-startup.pl

      # Reload Perl modules when changed on disk
      PerlModule Apache2::Reload
      PerlInitHandler Apache2::Reload

      # general mod_perl2 options
      <Location /otrs>
      # ErrorDocument 403 /otrs/customer.pl
      ErrorDocument 403 /otrs/index.pl
      SetHandler perl-script
      PerlResponseHandler ModPerl::Registry
      Options +ExecCGI
      PerlOptions +ParseHeaders
      PerlOptions +SetupEnv

      <IfModule mod_version.c>
      <IfVersion < 2.4>
      Order allow,deny
      Allow from all
      </IfVersion>
      <IfVersion >= 2.4>
      Require all granted
      </IfVersion>
      </IfModule>
      <IfModule !mod_version.c>
      Order allow,deny
      Allow from all
      </IfModule>
      </Location>

      # mod_perl2 options for GenericInterface
      <Location /otrs/nph-genericinterface.pl>
      PerlOptions -ParseHeaders
      </Location>

      </IfModule>

      <Directory "/opt/otrs/bin/cgi-bin/">
      <Directory "/opt/otrs/bin/cgi-bin/">
      AllowOverride None
      Options +ExecCGI -Includes

      <IfModule mod_version.c>
      <IfVersion < 2.4>
      Order allow,deny
      Allow from all
      </IfVersion>
      <IfVersion >= 2.4>
      Require all granted
      </IfVersion>
      </IfModule>
      <IfModule !mod_version.c>
      Order allow,deny
      Allow from all
      </IfModule>

      <IfModule mod_filter.c>
      <IfModule mod_deflate.c>
      AddOutputFilterByType DEFLATE text/html text/javascript application/javascript text/css text/xml application/json text/json
      </IfModule>
      </IfModule>

      </Directory>


      EDIT:



      Thank you. Here’s how I understand but please feel free to correct me. I’m here to learn from my mistakes 
      ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/" designates the target directory for CGI programs.



      In /opt/otrs/bin/cgi-bin/ I have the following content:



      drwxrwsr-x 4 otrs apache  205 Nov 13 16:39 ..
      drwxrwsr-x 2 otrs apache 139 Oct 22 09:27 .
      -rwxrwx--- 1 otrs apache 3.4K Sep 28 01:40 app.psgi
      -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 customer.pl
      -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 index.pl
      -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 installer.pl
      -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 nph-genericinterface.pl
      -rwxrwx--- 1 otrs apache 1.2K Sep 28 01:40 public.pl
      -rwxrwx--- 1 otrs apache 7.2K Sep 28 01:40 rpc.pl


      So as per my understanding if I call https://ipv4/otrs/index.pl it will trigger that particular script located under /opt/otrs/bin/cgi-bin/



      So with the section all the scripts under "/opt/otrs/bin/cgi-bin/" will have the options between <Location /otrs> </Location> applied. If I access https://ipv4/otrs/nph-genericinterface.pl the options from the section <Location /otrs> </Location> will be merged along with the options set within <Location /otrs/nph-genericinterface.pl> </Location>



      But then I have the same content defined under <Directory "/opt/otrs/bin/cgi-bin/">



      What is the reason for this ? Aren't both directives referring to exactly the same thing ?







      apache-httpd






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 at 14:08

























      asked Nov 14 at 10:54









      blablatrace

      487




      487






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          The Directory and Files specifications apply specifically to the file system. Typically, access to only a few directory trees is permitted. Access to certain files such as .htaccess is usually forbidden, For some sites, the Directory and File specifications are sufficient, and no Location specifications are required. These specifications are generally used to control which directories can be accessed.



          Location specifications apply to the webspace (which may contain content which does not exist in the file system). This is more in line with the design of a website, and don't require consideration of the directory path. These options typically specify how content on specific paths is handled.



          There are precedence rules and ordering rules the control which specifications will apply. Ordering of the two Location blocks is important.



          Setting things like the perl-script handler can be done in many locations. To some extent choosing where to set it requires understanding how much of the site you want delivered as perl CGI content. Restricted access is generally more secure. As Location directives override (where permitted) Directory directives, they provide the least access. If the directory, was accessible by a diferrent URL path, the Location directives would not apply.



          Original response:
          It is unusual for Location and Directory to point to the same location. Normally, the site root is /var/www or some similar directory. In your case it appears you are using various directories within /opt.



          For otrs, the Directory specification is /opt/otrs/bin/cgi-bin and the Location would be /otrs. For 'ortr-web', the Directory specification is /opt/otrs/var/httpd/htdocs and the Location would be /otrs-web.



          If you scan the Apache configuration you should notice that access to directory '/' is denied, and access to the site root is permitted. Normally access to the file system is controlled with Directory specifications, and access to URL paths is controlled with Location specifications. Baring the use of alias specifications Location specifications are relative to the directory specified in the Docroot. Location can specify virtual locations which don't exist on disk such as /server-status and /server-info.






          share|improve this answer























          • please see the edit of my question
            – blablatrace
            Nov 14 at 14:02











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481677%2freason-of-using-location-and-directory-for-the-same-objects-in-apache%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote













          The Directory and Files specifications apply specifically to the file system. Typically, access to only a few directory trees is permitted. Access to certain files such as .htaccess is usually forbidden, For some sites, the Directory and File specifications are sufficient, and no Location specifications are required. These specifications are generally used to control which directories can be accessed.



          Location specifications apply to the webspace (which may contain content which does not exist in the file system). This is more in line with the design of a website, and don't require consideration of the directory path. These options typically specify how content on specific paths is handled.



          There are precedence rules and ordering rules the control which specifications will apply. Ordering of the two Location blocks is important.



          Setting things like the perl-script handler can be done in many locations. To some extent choosing where to set it requires understanding how much of the site you want delivered as perl CGI content. Restricted access is generally more secure. As Location directives override (where permitted) Directory directives, they provide the least access. If the directory, was accessible by a diferrent URL path, the Location directives would not apply.



          Original response:
          It is unusual for Location and Directory to point to the same location. Normally, the site root is /var/www or some similar directory. In your case it appears you are using various directories within /opt.



          For otrs, the Directory specification is /opt/otrs/bin/cgi-bin and the Location would be /otrs. For 'ortr-web', the Directory specification is /opt/otrs/var/httpd/htdocs and the Location would be /otrs-web.



          If you scan the Apache configuration you should notice that access to directory '/' is denied, and access to the site root is permitted. Normally access to the file system is controlled with Directory specifications, and access to URL paths is controlled with Location specifications. Baring the use of alias specifications Location specifications are relative to the directory specified in the Docroot. Location can specify virtual locations which don't exist on disk such as /server-status and /server-info.






          share|improve this answer























          • please see the edit of my question
            – blablatrace
            Nov 14 at 14:02















          up vote
          2
          down vote













          The Directory and Files specifications apply specifically to the file system. Typically, access to only a few directory trees is permitted. Access to certain files such as .htaccess is usually forbidden, For some sites, the Directory and File specifications are sufficient, and no Location specifications are required. These specifications are generally used to control which directories can be accessed.



          Location specifications apply to the webspace (which may contain content which does not exist in the file system). This is more in line with the design of a website, and don't require consideration of the directory path. These options typically specify how content on specific paths is handled.



          There are precedence rules and ordering rules the control which specifications will apply. Ordering of the two Location blocks is important.



          Setting things like the perl-script handler can be done in many locations. To some extent choosing where to set it requires understanding how much of the site you want delivered as perl CGI content. Restricted access is generally more secure. As Location directives override (where permitted) Directory directives, they provide the least access. If the directory, was accessible by a diferrent URL path, the Location directives would not apply.



          Original response:
          It is unusual for Location and Directory to point to the same location. Normally, the site root is /var/www or some similar directory. In your case it appears you are using various directories within /opt.



          For otrs, the Directory specification is /opt/otrs/bin/cgi-bin and the Location would be /otrs. For 'ortr-web', the Directory specification is /opt/otrs/var/httpd/htdocs and the Location would be /otrs-web.



          If you scan the Apache configuration you should notice that access to directory '/' is denied, and access to the site root is permitted. Normally access to the file system is controlled with Directory specifications, and access to URL paths is controlled with Location specifications. Baring the use of alias specifications Location specifications are relative to the directory specified in the Docroot. Location can specify virtual locations which don't exist on disk such as /server-status and /server-info.






          share|improve this answer























          • please see the edit of my question
            – blablatrace
            Nov 14 at 14:02













          up vote
          2
          down vote










          up vote
          2
          down vote









          The Directory and Files specifications apply specifically to the file system. Typically, access to only a few directory trees is permitted. Access to certain files such as .htaccess is usually forbidden, For some sites, the Directory and File specifications are sufficient, and no Location specifications are required. These specifications are generally used to control which directories can be accessed.



          Location specifications apply to the webspace (which may contain content which does not exist in the file system). This is more in line with the design of a website, and don't require consideration of the directory path. These options typically specify how content on specific paths is handled.



          There are precedence rules and ordering rules the control which specifications will apply. Ordering of the two Location blocks is important.



          Setting things like the perl-script handler can be done in many locations. To some extent choosing where to set it requires understanding how much of the site you want delivered as perl CGI content. Restricted access is generally more secure. As Location directives override (where permitted) Directory directives, they provide the least access. If the directory, was accessible by a diferrent URL path, the Location directives would not apply.



          Original response:
          It is unusual for Location and Directory to point to the same location. Normally, the site root is /var/www or some similar directory. In your case it appears you are using various directories within /opt.



          For otrs, the Directory specification is /opt/otrs/bin/cgi-bin and the Location would be /otrs. For 'ortr-web', the Directory specification is /opt/otrs/var/httpd/htdocs and the Location would be /otrs-web.



          If you scan the Apache configuration you should notice that access to directory '/' is denied, and access to the site root is permitted. Normally access to the file system is controlled with Directory specifications, and access to URL paths is controlled with Location specifications. Baring the use of alias specifications Location specifications are relative to the directory specified in the Docroot. Location can specify virtual locations which don't exist on disk such as /server-status and /server-info.






          share|improve this answer














          The Directory and Files specifications apply specifically to the file system. Typically, access to only a few directory trees is permitted. Access to certain files such as .htaccess is usually forbidden, For some sites, the Directory and File specifications are sufficient, and no Location specifications are required. These specifications are generally used to control which directories can be accessed.



          Location specifications apply to the webspace (which may contain content which does not exist in the file system). This is more in line with the design of a website, and don't require consideration of the directory path. These options typically specify how content on specific paths is handled.



          There are precedence rules and ordering rules the control which specifications will apply. Ordering of the two Location blocks is important.



          Setting things like the perl-script handler can be done in many locations. To some extent choosing where to set it requires understanding how much of the site you want delivered as perl CGI content. Restricted access is generally more secure. As Location directives override (where permitted) Directory directives, they provide the least access. If the directory, was accessible by a diferrent URL path, the Location directives would not apply.



          Original response:
          It is unusual for Location and Directory to point to the same location. Normally, the site root is /var/www or some similar directory. In your case it appears you are using various directories within /opt.



          For otrs, the Directory specification is /opt/otrs/bin/cgi-bin and the Location would be /otrs. For 'ortr-web', the Directory specification is /opt/otrs/var/httpd/htdocs and the Location would be /otrs-web.



          If you scan the Apache configuration you should notice that access to directory '/' is denied, and access to the site root is permitted. Normally access to the file system is controlled with Directory specifications, and access to URL paths is controlled with Location specifications. Baring the use of alias specifications Location specifications are relative to the directory specified in the Docroot. Location can specify virtual locations which don't exist on disk such as /server-status and /server-info.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 15 at 14:46

























          answered Nov 14 at 13:33









          BillThor

          7,5651325




          7,5651325












          • please see the edit of my question
            – blablatrace
            Nov 14 at 14:02


















          • please see the edit of my question
            – blablatrace
            Nov 14 at 14:02
















          please see the edit of my question
          – blablatrace
          Nov 14 at 14:02




          please see the edit of my question
          – blablatrace
          Nov 14 at 14:02


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481677%2freason-of-using-location-and-directory-for-the-same-objects-in-apache%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Morgemoulin

          Scott Moir

          Souastre