Apache : use of Alias directive with mod FastCGINginx + PHP-FPM = “Random” 502 Bad GatewaySingle fastcgi/php-cgi server for multiple virtualhosts?nginx/fastCGI two domains, one codebase and a subdirectoryWhy the php-cgi wrapper script for php-fpm? (Using virtualhost and suexec.)Live site with ssl enabled redirects to the staging site without sslFastCGI Error Access to the script deniedsetup apache and mod_fastcgi to work with php-fpm not workingPHP-FPM with Apache 2.2.22 and Ubuntu 12.10 - 500 Error, or returns text (not executing)How to configure php-fpm for php 5.6 and apache 2.2FastCGI: “comm with server aborted: read failed” only for one specific file

Shall I use personal or official e-mail account when registering to external websites for work purpose?

Why is the design of haulage companies so “special”?

What does "enim et" mean?

Imbalanced dataset binary classification

What is the offset in a seaplane's hull?

Extreme, but not acceptable situation and I can't start the work tomorrow morning

Process builder are scheduled actions independent?

Why use `cat` to view a file?

aging parents with no investments

Why does this relative pronoun not take the case of the noun it is referring to?

How can I add custom success page

I see my dog run

What to wear for invited talk in Canada

How do I create uniquely male characters?

Manga about a female worker who got dragged into another world together with this high school girl and she was just told she's not needed anymore

Least quadratic residue under GRH: an explicit bound

How can I fix this gap between bookcases I made?

What are the advantages and disadvantages of running one shots compared to campaigns?

Why is an old chain unsafe?

Need help identifying/translating a plaque in Tangier, Morocco

Is there a familial term for apples and pears?

LM317 - Calculate dissipation due to voltage drop

Was there ever an axiom rendered a theorem?

What do the Banks children have against barley water?



Apache : use of Alias directive with mod FastCGI


Nginx + PHP-FPM = “Random” 502 Bad GatewaySingle fastcgi/php-cgi server for multiple virtualhosts?nginx/fastCGI two domains, one codebase and a subdirectoryWhy the php-cgi wrapper script for php-fpm? (Using virtualhost and suexec.)Live site with ssl enabled redirects to the staging site without sslFastCGI Error Access to the script deniedsetup apache and mod_fastcgi to work with php-fpm not workingPHP-FPM with Apache 2.2.22 and Ubuntu 12.10 - 500 Error, or returns text (not executing)How to configure php-fpm for php 5.6 and apache 2.2FastCGI: “comm with server aborted: read failed” only for one specific file






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








4















The server is configured to handle php files with fastcgi :



<IfModule mod_fastcgi.c>
AddHandler application/x-httpd-php .php
Action application/x-httpd-php /fcgi-bin/php-fpm virtual
ScriptAlias /fcgi-bin/php-fpm /fcgi-extsrvs-phpfpm
<Location "/fcgi-bin/php-fpm">
Order Deny,Allow
Deny from All
Allow from env=REDIRECT_STATUS
</Location>

</IfModule>


Then a virtual host is defined to use this fastcgi :



<VirtualHost *:80>
ServerName mydomain.org

DocumentRoot /var/www/mydomain.org

<Location />
Order Allow,Deny
Allow from All
AllowOverride None
</Location>

<IfModule mod_fastcgi.c>
# use the socket as defined for this pool
FastCgiExternalServer /fcgi-extsrvs-phpfpm -socket /var/run/php5-fpm/mydomain.org.sock
</IfModule>

# problem here
AliasMatch ^/(.*) /var/www/mydomain.org/index.php

</VirtualHost>


Everything is working fine, until I add the AliasMatch line (same problem with Alias). The goal is to handle every request with the index.php script.
This cause a 500 error with the following log :



[error] [client 88.xxx.xxx.20] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[debug] core.c(3112): [client 88.xxx.xxx.20] r->uri = /fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/
[debug] core.c(3118): [client 88.xxx.xxx.20] redirected from r->uri = /fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/
...
[debug] core.c(3118): [client 88.xxx.xxx.20] redirected from r->uri = /fcgi-bin/php-fpm/
[debug] core.c(3118): [client 88.xxx.xxx.20] redirected from r->uri = /


My guess is there is a conflict between the ScriptAlias and AliasMatch, but I don't know how to resolve it.










share|improve this question




























    4















    The server is configured to handle php files with fastcgi :



    <IfModule mod_fastcgi.c>
    AddHandler application/x-httpd-php .php
    Action application/x-httpd-php /fcgi-bin/php-fpm virtual
    ScriptAlias /fcgi-bin/php-fpm /fcgi-extsrvs-phpfpm
    <Location "/fcgi-bin/php-fpm">
    Order Deny,Allow
    Deny from All
    Allow from env=REDIRECT_STATUS
    </Location>

    </IfModule>


    Then a virtual host is defined to use this fastcgi :



    <VirtualHost *:80>
    ServerName mydomain.org

    DocumentRoot /var/www/mydomain.org

    <Location />
    Order Allow,Deny
    Allow from All
    AllowOverride None
    </Location>

    <IfModule mod_fastcgi.c>
    # use the socket as defined for this pool
    FastCgiExternalServer /fcgi-extsrvs-phpfpm -socket /var/run/php5-fpm/mydomain.org.sock
    </IfModule>

    # problem here
    AliasMatch ^/(.*) /var/www/mydomain.org/index.php

    </VirtualHost>


    Everything is working fine, until I add the AliasMatch line (same problem with Alias). The goal is to handle every request with the index.php script.
    This cause a 500 error with the following log :



    [error] [client 88.xxx.xxx.20] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
    [debug] core.c(3112): [client 88.xxx.xxx.20] r->uri = /fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/
    [debug] core.c(3118): [client 88.xxx.xxx.20] redirected from r->uri = /fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/
    ...
    [debug] core.c(3118): [client 88.xxx.xxx.20] redirected from r->uri = /fcgi-bin/php-fpm/
    [debug] core.c(3118): [client 88.xxx.xxx.20] redirected from r->uri = /


    My guess is there is a conflict between the ScriptAlias and AliasMatch, but I don't know how to resolve it.










    share|improve this question
























      4












      4








      4








      The server is configured to handle php files with fastcgi :



      <IfModule mod_fastcgi.c>
      AddHandler application/x-httpd-php .php
      Action application/x-httpd-php /fcgi-bin/php-fpm virtual
      ScriptAlias /fcgi-bin/php-fpm /fcgi-extsrvs-phpfpm
      <Location "/fcgi-bin/php-fpm">
      Order Deny,Allow
      Deny from All
      Allow from env=REDIRECT_STATUS
      </Location>

      </IfModule>


      Then a virtual host is defined to use this fastcgi :



      <VirtualHost *:80>
      ServerName mydomain.org

      DocumentRoot /var/www/mydomain.org

      <Location />
      Order Allow,Deny
      Allow from All
      AllowOverride None
      </Location>

      <IfModule mod_fastcgi.c>
      # use the socket as defined for this pool
      FastCgiExternalServer /fcgi-extsrvs-phpfpm -socket /var/run/php5-fpm/mydomain.org.sock
      </IfModule>

      # problem here
      AliasMatch ^/(.*) /var/www/mydomain.org/index.php

      </VirtualHost>


      Everything is working fine, until I add the AliasMatch line (same problem with Alias). The goal is to handle every request with the index.php script.
      This cause a 500 error with the following log :



      [error] [client 88.xxx.xxx.20] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
      [debug] core.c(3112): [client 88.xxx.xxx.20] r->uri = /fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/
      [debug] core.c(3118): [client 88.xxx.xxx.20] redirected from r->uri = /fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/
      ...
      [debug] core.c(3118): [client 88.xxx.xxx.20] redirected from r->uri = /fcgi-bin/php-fpm/
      [debug] core.c(3118): [client 88.xxx.xxx.20] redirected from r->uri = /


      My guess is there is a conflict between the ScriptAlias and AliasMatch, but I don't know how to resolve it.










      share|improve this question














      The server is configured to handle php files with fastcgi :



      <IfModule mod_fastcgi.c>
      AddHandler application/x-httpd-php .php
      Action application/x-httpd-php /fcgi-bin/php-fpm virtual
      ScriptAlias /fcgi-bin/php-fpm /fcgi-extsrvs-phpfpm
      <Location "/fcgi-bin/php-fpm">
      Order Deny,Allow
      Deny from All
      Allow from env=REDIRECT_STATUS
      </Location>

      </IfModule>


      Then a virtual host is defined to use this fastcgi :



      <VirtualHost *:80>
      ServerName mydomain.org

      DocumentRoot /var/www/mydomain.org

      <Location />
      Order Allow,Deny
      Allow from All
      AllowOverride None
      </Location>

      <IfModule mod_fastcgi.c>
      # use the socket as defined for this pool
      FastCgiExternalServer /fcgi-extsrvs-phpfpm -socket /var/run/php5-fpm/mydomain.org.sock
      </IfModule>

      # problem here
      AliasMatch ^/(.*) /var/www/mydomain.org/index.php

      </VirtualHost>


      Everything is working fine, until I add the AliasMatch line (same problem with Alias). The goal is to handle every request with the index.php script.
      This cause a 500 error with the following log :



      [error] [client 88.xxx.xxx.20] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
      [debug] core.c(3112): [client 88.xxx.xxx.20] r->uri = /fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/
      [debug] core.c(3118): [client 88.xxx.xxx.20] redirected from r->uri = /fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/fcgi-bin/php-fpm/
      ...
      [debug] core.c(3118): [client 88.xxx.xxx.20] redirected from r->uri = /fcgi-bin/php-fpm/
      [debug] core.c(3118): [client 88.xxx.xxx.20] redirected from r->uri = /


      My guess is there is a conflict between the ScriptAlias and AliasMatch, but I don't know how to resolve it.







      apache-2.2 fastcgi






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 29 '13 at 13:44









      challetchallet

      1212




      1212




















          1 Answer
          1






          active

          oldest

          votes


















          0














          Her's a solution to a simmilar problem
          http://www.tokiwinter.com/avoiding-infinite-recursion-with-mod_rewrite-and-mod_fastcgi/ TL;DR use mod_rewrite and disabling rewriting for php script url



          But I strongly suggest moving to apache2.4 and using mod_proxy_fcgi
          https://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html where You can



          <FilesMatch ".php$">
          SetHandler "proxy:unix:/var/run/php5-fpm/mydomain.org.sock|fcgi://host1/"
          </FilesMatch>


          And with that all the redirects, rewrites should work as expected. BTW mod_fastcgi is outdated, and ugly. If You prefer to stay with 2.2 (which is EOL'ed now) You can try https://github.com/lazy404/mod_fastcgi_handler (I use it on a busy site with php-fpm without any problems) it's config is also clean and compatible with redirects.






          share|improve this answer























          • oops it was asked 3y ago ;)

            – Lazy404
            May 31 '16 at 18:34











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "2"
          ;
          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2fserverfault.com%2fquestions%2f511672%2fapache-use-of-alias-directive-with-mod-fastcgi%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









          0














          Her's a solution to a simmilar problem
          http://www.tokiwinter.com/avoiding-infinite-recursion-with-mod_rewrite-and-mod_fastcgi/ TL;DR use mod_rewrite and disabling rewriting for php script url



          But I strongly suggest moving to apache2.4 and using mod_proxy_fcgi
          https://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html where You can



          <FilesMatch ".php$">
          SetHandler "proxy:unix:/var/run/php5-fpm/mydomain.org.sock|fcgi://host1/"
          </FilesMatch>


          And with that all the redirects, rewrites should work as expected. BTW mod_fastcgi is outdated, and ugly. If You prefer to stay with 2.2 (which is EOL'ed now) You can try https://github.com/lazy404/mod_fastcgi_handler (I use it on a busy site with php-fpm without any problems) it's config is also clean and compatible with redirects.






          share|improve this answer























          • oops it was asked 3y ago ;)

            – Lazy404
            May 31 '16 at 18:34















          0














          Her's a solution to a simmilar problem
          http://www.tokiwinter.com/avoiding-infinite-recursion-with-mod_rewrite-and-mod_fastcgi/ TL;DR use mod_rewrite and disabling rewriting for php script url



          But I strongly suggest moving to apache2.4 and using mod_proxy_fcgi
          https://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html where You can



          <FilesMatch ".php$">
          SetHandler "proxy:unix:/var/run/php5-fpm/mydomain.org.sock|fcgi://host1/"
          </FilesMatch>


          And with that all the redirects, rewrites should work as expected. BTW mod_fastcgi is outdated, and ugly. If You prefer to stay with 2.2 (which is EOL'ed now) You can try https://github.com/lazy404/mod_fastcgi_handler (I use it on a busy site with php-fpm without any problems) it's config is also clean and compatible with redirects.






          share|improve this answer























          • oops it was asked 3y ago ;)

            – Lazy404
            May 31 '16 at 18:34













          0












          0








          0







          Her's a solution to a simmilar problem
          http://www.tokiwinter.com/avoiding-infinite-recursion-with-mod_rewrite-and-mod_fastcgi/ TL;DR use mod_rewrite and disabling rewriting for php script url



          But I strongly suggest moving to apache2.4 and using mod_proxy_fcgi
          https://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html where You can



          <FilesMatch ".php$">
          SetHandler "proxy:unix:/var/run/php5-fpm/mydomain.org.sock|fcgi://host1/"
          </FilesMatch>


          And with that all the redirects, rewrites should work as expected. BTW mod_fastcgi is outdated, and ugly. If You prefer to stay with 2.2 (which is EOL'ed now) You can try https://github.com/lazy404/mod_fastcgi_handler (I use it on a busy site with php-fpm without any problems) it's config is also clean and compatible with redirects.






          share|improve this answer













          Her's a solution to a simmilar problem
          http://www.tokiwinter.com/avoiding-infinite-recursion-with-mod_rewrite-and-mod_fastcgi/ TL;DR use mod_rewrite and disabling rewriting for php script url



          But I strongly suggest moving to apache2.4 and using mod_proxy_fcgi
          https://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html where You can



          <FilesMatch ".php$">
          SetHandler "proxy:unix:/var/run/php5-fpm/mydomain.org.sock|fcgi://host1/"
          </FilesMatch>


          And with that all the redirects, rewrites should work as expected. BTW mod_fastcgi is outdated, and ugly. If You prefer to stay with 2.2 (which is EOL'ed now) You can try https://github.com/lazy404/mod_fastcgi_handler (I use it on a busy site with php-fpm without any problems) it's config is also clean and compatible with redirects.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 31 '16 at 18:33









          Lazy404Lazy404

          34016




          34016












          • oops it was asked 3y ago ;)

            – Lazy404
            May 31 '16 at 18:34

















          • oops it was asked 3y ago ;)

            – Lazy404
            May 31 '16 at 18:34
















          oops it was asked 3y ago ;)

          – Lazy404
          May 31 '16 at 18:34





          oops it was asked 3y ago ;)

          – Lazy404
          May 31 '16 at 18:34

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f511672%2fapache-use-of-alias-directive-with-mod-fastcgi%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

          How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

          What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

          Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos