How do I point my Subdomain to correct root folderapache + nginx(for only one subdomain)How do I point a...

How to pronounce the slash sign

Is the destination of a commercial flight important for the pilot?

Anatomically Correct Strange Women In Ponds Distributing Swords

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

What can we do to stop prior company from asking us questions?

Do sorcerers' Subtle Spells require a skill check to be unseen?

Sort a list by elements of another list

What is the best translation for "slot" in the context of multiplayer video games?

How did Doctor Strange see the winning outcome in Avengers: Infinity War?

Implement the Thanos sorting algorithm

How does it work when somebody invests in my business?

How to write papers efficiently when English isn't my first language?

Is exact Kanji stroke length important?

How to Reset Passwords on Multiple Websites Easily?

Would this custom Sorcerer variant that can only learn any verbal-component-only spell be unbalanced?

CREATE opcode: what does it really do?

Gears on left are inverse to gears on right?

Is HostGator storing my password in plaintext?

Term for the "extreme-extension" version of a straw man fallacy?

Failed to fetch jessie backports repository

Detecting if an element is found inside a container

Do the temporary hit points from the Battlerager barbarian's Reckless Abandon stack if I make multiple attacks on my turn?

Did Dumbledore lie to Harry about how long he had James Potter's invisibility cloak when he was examining it? If so, why?

How does Loki do this?



How do I point my Subdomain to correct root folder


apache + nginx(for only one subdomain)How do I point a domain to an Ubuntu VPS?Existing laravel 4 project gives 404 in browserLocal (non-root) installation folderMount point of network shared folderApache server does not respondUnable to stop nginx from redirecting to HTTPS on subdomainGet Apache2 running with nginx as reverse proxyEnable access through port address in subdomainnginx : websocket failed to connect













0















I have my production site set up and now I'm trying to setup a dev/staging site to run live tests in.



I'm having issues pointing my subdomain to the correct root path on my Laravel app.



I need the following:




  • dev.example.com to point to root /var/www/dev/public;

  • example.com and www.example.com to point to root /var/www/laravel/public;

  • currently everything is going to /var/www/laravel/public


Server:




  • Ubuntu 18.10 x64

  • Nginx


I have a domain example.com and I made a subdomain called dev.example.com
each reference to the domain is in my SSL Cert via certbot/LetsEncrypt. www.example.com, example.com and dev.example.com



DNS for Subdomain:



A (Record) | dev (Name) | 140.xx.xx.xx (Data)



I have 2 folders located here:




  • /var/www/laravel/public (My Main Production site)

  • /var/www/dev/public (My Development Site)


In sites-available /etc/nginx/sites-available I have the default file with the following configurations.



(I've tried multiple variation of this, but this is where I left off)



 server {

root /var/www/laravel/public;

index index.php index.html index.htm index.nginx-debian.html;

server_name example.com www.example.com dev.example.com;

location / {
try_files $uri $uri/ /index.php?$query_string;
client_max_body_size 200M;
}

location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}

location ~ /.ht {
deny all;
}

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

# Virtual Host configuration for example.com

server {

if ($host = dev.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

listen 80;
listen [::]:80;
server_name dev.example.com;
root /var/www/dev/public;
return 404; # managed by Certbot

}

server {

if ($host = www.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

listen 80;
listen [::]:80;
server_name www.example.com;
return 404; # managed by Certbot

}

server {

if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

listen 80 default_server;
listen [::]:80;
server_name example.com;
return 404; # managed by Certbot

}



Again...




  • I need dev.example.com to point to root /var/www/dev/public;


  • I need example.com and www.example.com to point to root /var/www/laravel/public;



Any help in figuring this out would be appreciated.










share|improve this question







New contributor




cwd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I have my production site set up and now I'm trying to setup a dev/staging site to run live tests in.



    I'm having issues pointing my subdomain to the correct root path on my Laravel app.



    I need the following:




    • dev.example.com to point to root /var/www/dev/public;

    • example.com and www.example.com to point to root /var/www/laravel/public;

    • currently everything is going to /var/www/laravel/public


    Server:




    • Ubuntu 18.10 x64

    • Nginx


    I have a domain example.com and I made a subdomain called dev.example.com
    each reference to the domain is in my SSL Cert via certbot/LetsEncrypt. www.example.com, example.com and dev.example.com



    DNS for Subdomain:



    A (Record) | dev (Name) | 140.xx.xx.xx (Data)



    I have 2 folders located here:




    • /var/www/laravel/public (My Main Production site)

    • /var/www/dev/public (My Development Site)


    In sites-available /etc/nginx/sites-available I have the default file with the following configurations.



    (I've tried multiple variation of this, but this is where I left off)



     server {

    root /var/www/laravel/public;

    index index.php index.html index.htm index.nginx-debian.html;

    server_name example.com www.example.com dev.example.com;

    location / {
    try_files $uri $uri/ /index.php?$query_string;
    client_max_body_size 200M;
    }

    location ~ .php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    }

    location ~ /.ht {
    deny all;
    }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    }

    # Virtual Host configuration for example.com

    server {

    if ($host = dev.example.com) {
    return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;
    server_name dev.example.com;
    root /var/www/dev/public;
    return 404; # managed by Certbot

    }

    server {

    if ($host = www.example.com) {
    return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;
    server_name www.example.com;
    return 404; # managed by Certbot

    }

    server {

    if ($host = example.com) {
    return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80 default_server;
    listen [::]:80;
    server_name example.com;
    return 404; # managed by Certbot

    }



    Again...




    • I need dev.example.com to point to root /var/www/dev/public;


    • I need example.com and www.example.com to point to root /var/www/laravel/public;



    Any help in figuring this out would be appreciated.










    share|improve this question







    New contributor




    cwd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I have my production site set up and now I'm trying to setup a dev/staging site to run live tests in.



      I'm having issues pointing my subdomain to the correct root path on my Laravel app.



      I need the following:




      • dev.example.com to point to root /var/www/dev/public;

      • example.com and www.example.com to point to root /var/www/laravel/public;

      • currently everything is going to /var/www/laravel/public


      Server:




      • Ubuntu 18.10 x64

      • Nginx


      I have a domain example.com and I made a subdomain called dev.example.com
      each reference to the domain is in my SSL Cert via certbot/LetsEncrypt. www.example.com, example.com and dev.example.com



      DNS for Subdomain:



      A (Record) | dev (Name) | 140.xx.xx.xx (Data)



      I have 2 folders located here:




      • /var/www/laravel/public (My Main Production site)

      • /var/www/dev/public (My Development Site)


      In sites-available /etc/nginx/sites-available I have the default file with the following configurations.



      (I've tried multiple variation of this, but this is where I left off)



       server {

      root /var/www/laravel/public;

      index index.php index.html index.htm index.nginx-debian.html;

      server_name example.com www.example.com dev.example.com;

      location / {
      try_files $uri $uri/ /index.php?$query_string;
      client_max_body_size 200M;
      }

      location ~ .php$ {
      include snippets/fastcgi-php.conf;
      fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
      }

      location ~ /.ht {
      deny all;
      }

      listen [::]:443 ssl ipv6only=on; # managed by Certbot
      listen 443 ssl; # managed by Certbot
      ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
      ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

      }

      # Virtual Host configuration for example.com

      server {

      if ($host = dev.example.com) {
      return 301 https://$host$request_uri;
      } # managed by Certbot

      listen 80;
      listen [::]:80;
      server_name dev.example.com;
      root /var/www/dev/public;
      return 404; # managed by Certbot

      }

      server {

      if ($host = www.example.com) {
      return 301 https://$host$request_uri;
      } # managed by Certbot

      listen 80;
      listen [::]:80;
      server_name www.example.com;
      return 404; # managed by Certbot

      }

      server {

      if ($host = example.com) {
      return 301 https://$host$request_uri;
      } # managed by Certbot

      listen 80 default_server;
      listen [::]:80;
      server_name example.com;
      return 404; # managed by Certbot

      }



      Again...




      • I need dev.example.com to point to root /var/www/dev/public;


      • I need example.com and www.example.com to point to root /var/www/laravel/public;



      Any help in figuring this out would be appreciated.










      share|improve this question







      New contributor




      cwd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I have my production site set up and now I'm trying to setup a dev/staging site to run live tests in.



      I'm having issues pointing my subdomain to the correct root path on my Laravel app.



      I need the following:




      • dev.example.com to point to root /var/www/dev/public;

      • example.com and www.example.com to point to root /var/www/laravel/public;

      • currently everything is going to /var/www/laravel/public


      Server:




      • Ubuntu 18.10 x64

      • Nginx


      I have a domain example.com and I made a subdomain called dev.example.com
      each reference to the domain is in my SSL Cert via certbot/LetsEncrypt. www.example.com, example.com and dev.example.com



      DNS for Subdomain:



      A (Record) | dev (Name) | 140.xx.xx.xx (Data)



      I have 2 folders located here:




      • /var/www/laravel/public (My Main Production site)

      • /var/www/dev/public (My Development Site)


      In sites-available /etc/nginx/sites-available I have the default file with the following configurations.



      (I've tried multiple variation of this, but this is where I left off)



       server {

      root /var/www/laravel/public;

      index index.php index.html index.htm index.nginx-debian.html;

      server_name example.com www.example.com dev.example.com;

      location / {
      try_files $uri $uri/ /index.php?$query_string;
      client_max_body_size 200M;
      }

      location ~ .php$ {
      include snippets/fastcgi-php.conf;
      fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
      }

      location ~ /.ht {
      deny all;
      }

      listen [::]:443 ssl ipv6only=on; # managed by Certbot
      listen 443 ssl; # managed by Certbot
      ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
      ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

      }

      # Virtual Host configuration for example.com

      server {

      if ($host = dev.example.com) {
      return 301 https://$host$request_uri;
      } # managed by Certbot

      listen 80;
      listen [::]:80;
      server_name dev.example.com;
      root /var/www/dev/public;
      return 404; # managed by Certbot

      }

      server {

      if ($host = www.example.com) {
      return 301 https://$host$request_uri;
      } # managed by Certbot

      listen 80;
      listen [::]:80;
      server_name www.example.com;
      return 404; # managed by Certbot

      }

      server {

      if ($host = example.com) {
      return 301 https://$host$request_uri;
      } # managed by Certbot

      listen 80 default_server;
      listen [::]:80;
      server_name example.com;
      return 404; # managed by Certbot

      }



      Again...




      • I need dev.example.com to point to root /var/www/dev/public;


      • I need example.com and www.example.com to point to root /var/www/laravel/public;



      Any help in figuring this out would be appreciated.







      16.04 18.10 nginx vps






      share|improve this question







      New contributor




      cwd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      cwd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      cwd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 14 mins ago









      cwdcwd

      101




      101




      New contributor




      cwd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      cwd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      cwd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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
          });


          }
          });






          cwd is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1129294%2fhow-do-i-point-my-subdomain-to-correct-root-folder%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          cwd is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          cwd is a new contributor. Be nice, and check out our Code of Conduct.













          cwd is a new contributor. Be nice, and check out our Code of Conduct.












          cwd is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Ask Ubuntu!


          • 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%2faskubuntu.com%2fquestions%2f1129294%2fhow-do-i-point-my-subdomain-to-correct-root-folder%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

          Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

          Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

          Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...