How to configure an alias in nginx Announcing the arrival of Valued Associate #679: Cesar...

Has a Nobel Peace laureate ever been accused of war crimes?

What is the numbering system used for the DSN dishes?

Will temporary Dex penalties prevent you from getting the benefits of the "Two Weapon Fighting" feat if your Dex score falls below the prerequisite?

"Working on a knee"

Will I be more secure with my own router behind my ISP's router?

What do you call an IPA symbol that lacks a name (e.g. ɲ)?

Philosophers who were composers?

How to translate "red flag" into Spanish?

What does the black goddess statue do and what is it?

What were wait-states, and why was it only an issue for PCs?

Is there a verb for listening stealthily?

Test if all elements of a Foldable are the same

What's called a person who works as someone who puts products on shelves in stores?

Marquee sign letters

Can gravitational waves pass through a black hole?

Why is arima in R one time step off?

Arriving in Atlanta (after US Preclearance in Dublin). Will I go through TSA security in Atlanta to transfer to a connecting flight?

/bin/ls sorts differently than just ls

TV series episode where humans nuke aliens before decrypting their message that states they come in peace

Does a Draconic Bloodline sorcerer's doubled proficiency bonus for Charisma checks against dragons apply to all dragon types or only the chosen one?

Could a cockatrice have parasitic embryos?

What *exactly* is electrical current, voltage, and resistance?

Israeli soda type drink

Is Bran literally the world's memory?



How to configure an alias in nginx



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern)
Come Celebrate our 10 Year Anniversary!Blank Page: wordpress on nginx+php-fpmConfigure php5-fpm for many concurrent usersNginx gives 504 Gateway Time-out once moved to liveNginx subversion commit failurenginx php5-fpm path_info urls and root locationNGINX don't parse .php5 as .phpLaravel 4.1 on nginx routes error 404nginx rewrite throw 404 with last and breaknginx PHP files downloading instead of executingCodeIgniter nginx rewrite rules for i8ln URL's





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







0















Im switching from apache to nginx and im not sure how i would do the following in nginx.



<VirtualHost *:80>
ServerName example.com
ProxyRequests On

Alias /faq /var/www/http
<Directory /var/www/http/>
Options Indexes FollowSymLinks
AllowOverride ALL
Require all granted
</Directory>

ProxyPassMatch ^/faq !

ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

ErrorLog ${APACHE_LOG_DIR}/http.log
CustomLog ${APACHE_LOG_DIR}/http.log combined




i currently have this but i keep getting a 404 error



server {
listen 80;
server_name example.com;
client_max_body_size 30M;

location / {
proxy_pass http://localhost:8080/;
include /etc/nginx/proxy_params;
}

location /faq/ {
proxy_redirect off;
alias /var/www/http;
index index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}

}

location ~ /faq.php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}


}










share|improve this question














bumped to the homepage by Community 1 min ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















    0















    Im switching from apache to nginx and im not sure how i would do the following in nginx.



    <VirtualHost *:80>
    ServerName example.com
    ProxyRequests On

    Alias /faq /var/www/http
    <Directory /var/www/http/>
    Options Indexes FollowSymLinks
    AllowOverride ALL
    Require all granted
    </Directory>

    ProxyPassMatch ^/faq !

    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

    ErrorLog ${APACHE_LOG_DIR}/http.log
    CustomLog ${APACHE_LOG_DIR}/http.log combined




    i currently have this but i keep getting a 404 error



    server {
    listen 80;
    server_name example.com;
    client_max_body_size 30M;

    location / {
    proxy_pass http://localhost:8080/;
    include /etc/nginx/proxy_params;
    }

    location /faq/ {
    proxy_redirect off;
    alias /var/www/http;
    index index.php;
    if (!-e $request_filename) {
    rewrite ^/(.*)$ /index.php?q=$1 last;
    }

    }

    location ~ /faq.php$ {
    fastcgi_split_path_info ^(.+.php)(/.+)$;
    # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    #
    # # With php5-cgi alone:
    # fastcgi_pass 127.0.0.1:9000;
    # # With php5-fpm:
    fastcgi_pass unix:/var/run/php7.0-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    }


    }










    share|improve this question














    bumped to the homepage by Community 1 min ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0








      Im switching from apache to nginx and im not sure how i would do the following in nginx.



      <VirtualHost *:80>
      ServerName example.com
      ProxyRequests On

      Alias /faq /var/www/http
      <Directory /var/www/http/>
      Options Indexes FollowSymLinks
      AllowOverride ALL
      Require all granted
      </Directory>

      ProxyPassMatch ^/faq !

      ProxyPass / http://localhost:8080/
      ProxyPassReverse / http://localhost:8080/

      ErrorLog ${APACHE_LOG_DIR}/http.log
      CustomLog ${APACHE_LOG_DIR}/http.log combined




      i currently have this but i keep getting a 404 error



      server {
      listen 80;
      server_name example.com;
      client_max_body_size 30M;

      location / {
      proxy_pass http://localhost:8080/;
      include /etc/nginx/proxy_params;
      }

      location /faq/ {
      proxy_redirect off;
      alias /var/www/http;
      index index.php;
      if (!-e $request_filename) {
      rewrite ^/(.*)$ /index.php?q=$1 last;
      }

      }

      location ~ /faq.php$ {
      fastcgi_split_path_info ^(.+.php)(/.+)$;
      # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
      #
      # # With php5-cgi alone:
      # fastcgi_pass 127.0.0.1:9000;
      # # With php5-fpm:
      fastcgi_pass unix:/var/run/php7.0-fpm.sock;
      fastcgi_index index.php;
      include fastcgi_params;
      }


      }










      share|improve this question














      Im switching from apache to nginx and im not sure how i would do the following in nginx.



      <VirtualHost *:80>
      ServerName example.com
      ProxyRequests On

      Alias /faq /var/www/http
      <Directory /var/www/http/>
      Options Indexes FollowSymLinks
      AllowOverride ALL
      Require all granted
      </Directory>

      ProxyPassMatch ^/faq !

      ProxyPass / http://localhost:8080/
      ProxyPassReverse / http://localhost:8080/

      ErrorLog ${APACHE_LOG_DIR}/http.log
      CustomLog ${APACHE_LOG_DIR}/http.log combined




      i currently have this but i keep getting a 404 error



      server {
      listen 80;
      server_name example.com;
      client_max_body_size 30M;

      location / {
      proxy_pass http://localhost:8080/;
      include /etc/nginx/proxy_params;
      }

      location /faq/ {
      proxy_redirect off;
      alias /var/www/http;
      index index.php;
      if (!-e $request_filename) {
      rewrite ^/(.*)$ /index.php?q=$1 last;
      }

      }

      location ~ /faq.php$ {
      fastcgi_split_path_info ^(.+.php)(/.+)$;
      # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
      #
      # # With php5-cgi alone:
      # fastcgi_pass 127.0.0.1:9000;
      # # With php5-fpm:
      fastcgi_pass unix:/var/run/php7.0-fpm.sock;
      fastcgi_index index.php;
      include fastcgi_params;
      }


      }







      nginx alias






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 3 '16 at 13:37









      GazGaz

      111




      111





      bumped to the homepage by Community 1 min ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 1 min ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          instead of alias /var/www/http; use root /var/www/http;



          Also instead of if for redirection to index.php you can use:



          try_files $uri $uri/ /index.php?$args;






          share|improve this answer
























            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%2f793613%2fhow-to-configure-an-alias-in-nginx%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














            instead of alias /var/www/http; use root /var/www/http;



            Also instead of if for redirection to index.php you can use:



            try_files $uri $uri/ /index.php?$args;






            share|improve this answer




























              0














              instead of alias /var/www/http; use root /var/www/http;



              Also instead of if for redirection to index.php you can use:



              try_files $uri $uri/ /index.php?$args;






              share|improve this answer


























                0












                0








                0







                instead of alias /var/www/http; use root /var/www/http;



                Also instead of if for redirection to index.php you can use:



                try_files $uri $uri/ /index.php?$args;






                share|improve this answer













                instead of alias /var/www/http; use root /var/www/http;



                Also instead of if for redirection to index.php you can use:



                try_files $uri $uri/ /index.php?$args;







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 3 '16 at 15:04









                Jakub PinkasJakub Pinkas

                713




                713






























                    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%2f793613%2fhow-to-configure-an-alias-in-nginx%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

                    As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

                    Список ссавців Італії Природоохоронні статуси | Список |...

                    Українські прізвища Зміст Історичні відомості |...