NGINX config only picks up root, otherwise is sending to error screen without alias












1















I'm attempting to link a particular subdirectory of my existing laravel site over to a wordpress installation. For some reason the root works, but all subdirectories of the root of the wordpress are not pointing to that folder.



I've attempted to add in wild cards to the location that is pointing over, but it doesn't seem to want to pick it up.



    server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name .swyftfilings.us;
root /home/forge/swyftfilings.us/public;

# FORGE SSL (DO NOT REMOVE!)
ssl_certificate /etc/nginx/ssl/swyftfilings.us/457933/server.crt;
ssl_certificate_key /etc/nginx/ssl/swyftfilings.us/457933/server.key;

ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparams.pem;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";

index index.html index.htm index.php;

charset utf-8;

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/swyftfilings.us/server/*;

location /learning-center {

alias /home/forge/learning-center/public;

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


location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

}

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

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

access_log off;
error_log /var/log/nginx/swyftfilings.us-error.log error;

error_page 404 /index.php;

location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

location ~ /.(?!well-known).* {
deny all;
}
}

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/swyftfilings.us/after/*;


Expected the url sub directory /learning-center/{anything here} to search within the 'learning-center/public' directory, however only /learning-center does.



EDIT: It looks like it will work, but only with files ending in .php










share|improve this question





























    1















    I'm attempting to link a particular subdirectory of my existing laravel site over to a wordpress installation. For some reason the root works, but all subdirectories of the root of the wordpress are not pointing to that folder.



    I've attempted to add in wild cards to the location that is pointing over, but it doesn't seem to want to pick it up.



        server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name .swyftfilings.us;
    root /home/forge/swyftfilings.us/public;

    # FORGE SSL (DO NOT REMOVE!)
    ssl_certificate /etc/nginx/ssl/swyftfilings.us/457933/server.crt;
    ssl_certificate_key /etc/nginx/ssl/swyftfilings.us/457933/server.key;

    ssl_protocols TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/swyftfilings.us/server/*;

    location /learning-center {

    alias /home/forge/learning-center/public;

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


    location ~ .php$ {
    fastcgi_split_path_info ^(.+.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    }

    }

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

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt { access_log off; log_not_found off; }

    access_log off;
    error_log /var/log/nginx/swyftfilings.us-error.log error;

    error_page 404 /index.php;

    location ~ .php$ {
    fastcgi_split_path_info ^(.+.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    }

    location ~ /.(?!well-known).* {
    deny all;
    }
    }

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/swyftfilings.us/after/*;


    Expected the url sub directory /learning-center/{anything here} to search within the 'learning-center/public' directory, however only /learning-center does.



    EDIT: It looks like it will work, but only with files ending in .php










    share|improve this question



























      1












      1








      1








      I'm attempting to link a particular subdirectory of my existing laravel site over to a wordpress installation. For some reason the root works, but all subdirectories of the root of the wordpress are not pointing to that folder.



      I've attempted to add in wild cards to the location that is pointing over, but it doesn't seem to want to pick it up.



          server {
      listen 443 ssl http2;
      listen [::]:443 ssl http2;
      server_name .swyftfilings.us;
      root /home/forge/swyftfilings.us/public;

      # FORGE SSL (DO NOT REMOVE!)
      ssl_certificate /etc/nginx/ssl/swyftfilings.us/457933/server.crt;
      ssl_certificate_key /etc/nginx/ssl/swyftfilings.us/457933/server.key;

      ssl_protocols TLSv1.2;
      ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
      ssl_prefer_server_ciphers on;
      ssl_dhparam /etc/nginx/dhparams.pem;

      add_header X-Frame-Options "SAMEORIGIN";
      add_header X-XSS-Protection "1; mode=block";
      add_header X-Content-Type-Options "nosniff";

      index index.html index.htm index.php;

      charset utf-8;

      # FORGE CONFIG (DO NOT REMOVE!)
      include forge-conf/swyftfilings.us/server/*;

      location /learning-center {

      alias /home/forge/learning-center/public;

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


      location ~ .php$ {
      fastcgi_split_path_info ^(.+.php)(/.+)$;
      fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
      fastcgi_index index.php;
      include fastcgi_params;
      }

      }

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

      location = /favicon.ico { access_log off; log_not_found off; }
      location = /robots.txt { access_log off; log_not_found off; }

      access_log off;
      error_log /var/log/nginx/swyftfilings.us-error.log error;

      error_page 404 /index.php;

      location ~ .php$ {
      fastcgi_split_path_info ^(.+.php)(/.+)$;
      fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
      fastcgi_index index.php;
      include fastcgi_params;
      }

      location ~ /.(?!well-known).* {
      deny all;
      }
      }

      # FORGE CONFIG (DO NOT REMOVE!)
      include forge-conf/swyftfilings.us/after/*;


      Expected the url sub directory /learning-center/{anything here} to search within the 'learning-center/public' directory, however only /learning-center does.



      EDIT: It looks like it will work, but only with files ending in .php










      share|improve this question
















      I'm attempting to link a particular subdirectory of my existing laravel site over to a wordpress installation. For some reason the root works, but all subdirectories of the root of the wordpress are not pointing to that folder.



      I've attempted to add in wild cards to the location that is pointing over, but it doesn't seem to want to pick it up.



          server {
      listen 443 ssl http2;
      listen [::]:443 ssl http2;
      server_name .swyftfilings.us;
      root /home/forge/swyftfilings.us/public;

      # FORGE SSL (DO NOT REMOVE!)
      ssl_certificate /etc/nginx/ssl/swyftfilings.us/457933/server.crt;
      ssl_certificate_key /etc/nginx/ssl/swyftfilings.us/457933/server.key;

      ssl_protocols TLSv1.2;
      ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
      ssl_prefer_server_ciphers on;
      ssl_dhparam /etc/nginx/dhparams.pem;

      add_header X-Frame-Options "SAMEORIGIN";
      add_header X-XSS-Protection "1; mode=block";
      add_header X-Content-Type-Options "nosniff";

      index index.html index.htm index.php;

      charset utf-8;

      # FORGE CONFIG (DO NOT REMOVE!)
      include forge-conf/swyftfilings.us/server/*;

      location /learning-center {

      alias /home/forge/learning-center/public;

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


      location ~ .php$ {
      fastcgi_split_path_info ^(.+.php)(/.+)$;
      fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
      fastcgi_index index.php;
      include fastcgi_params;
      }

      }

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

      location = /favicon.ico { access_log off; log_not_found off; }
      location = /robots.txt { access_log off; log_not_found off; }

      access_log off;
      error_log /var/log/nginx/swyftfilings.us-error.log error;

      error_page 404 /index.php;

      location ~ .php$ {
      fastcgi_split_path_info ^(.+.php)(/.+)$;
      fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
      fastcgi_index index.php;
      include fastcgi_params;
      }

      location ~ /.(?!well-known).* {
      deny all;
      }
      }

      # FORGE CONFIG (DO NOT REMOVE!)
      include forge-conf/swyftfilings.us/after/*;


      Expected the url sub directory /learning-center/{anything here} to search within the 'learning-center/public' directory, however only /learning-center does.



      EDIT: It looks like it will work, but only with files ending in .php







      wordpress laravel nginx laravel-forge






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 3 at 20:56







      Brandon Korenek

















      asked Jan 3 at 19:51









      Brandon KorenekBrandon Korenek

      87112




      87112
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          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%2fstackoverflow.com%2fquestions%2f54028901%2fnginx-config-only-picks-up-root-otherwise-is-sending-to-error-screen-without-al%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
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • 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%2fstackoverflow.com%2fquestions%2f54028901%2fnginx-config-only-picks-up-root-otherwise-is-sending-to-error-screen-without-al%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

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas