WordPress multisite with root url as Laravel application

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

WordPress multisite with root url as Laravel application

wld75
I am running a wordpress multisite website with subdomain option. example.me
is my main website https://one.example.me, https://two.example.me/two etc
are the network websites.

Now I am planning to have a small laravel application accessible at
example.me. I tried using different combination but not able to figure this
out. Could not find any examples in search results as well.Can someone let
me know how can I use laravel webapp at main/root address https://example.me
and mutilsite with subdomain ?

I am new to NGINX. Here is my nginx code.

map $http_host $blogid {
    default 0;
    include
/var/www/goingplacesme/wp-content/uploads/nginx-helper/map.conf;
}

server {
        listen 80;
        listen [::]:80;

        root /var/www/exampleme;

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

        server_name example.me www.example.me;

        location / {
                #try_files $uri $uri/ =404;
                try_files $uri /index.php$is_args$args;
        }

        # pass the PHP scripts to FastCGI server listening on
127.0.0.1:9000
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                # With php7.0-cgi alone:
                #fastcgi_pass 127.0.0.1:9000;
                # With php7.0-fpm:
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
        location ~ ^/files/(.*)$ {
          try_files /wp-content/blogs.dir/$blogid/$uri
/wp-includes/ms-files.php?file=$1 ;
          access_log off; log_not_found off; expires max;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires 24h;
                log_not_found off;
        }

        location ^~ /blogs.dir {
                internal;
                alias /var/www/pathtoyoursite/web/wp-content/blogs.dir ;
                access_log off; log_not_found off;      expires max;
        }



        if (!-e $request_filename) {
                rewrite /wp-admin$ $scheme://$host$uri/ permanent;
                rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
                rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
        }

}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,280904,280904#msg-280904

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: WordPress multisite with root url as Laravel application

Danila Vershinin
Hi,

Why not just create 2 server blocks, one for root domain and the other for WP multisite subdomains?

As in:

server {
  server_name example.com www.example.com;
  … Laravel directives go here
}

server {
  server_name *.example.com;
  .. WP multisite directives go here
}



Best Regards,
Danila

On 17 Aug 2018, at 16:49, conquistadorjd <[hidden email]> wrote:

I am running a wordpress multisite website with subdomain option. example.me
is my main website https://one.example.me, https://two.example.me/two etc
are the network websites.

Now I am planning to have a small laravel application accessible at
example.me. I tried using different combination but not able to figure this
out. Could not find any examples in search results as well.Can someone let
me know how can I use laravel webapp at main/root address https://example.me
and mutilsite with subdomain ?

I am new to NGINX. Here is my nginx code.

map $http_host $blogid {
   default 0;
   include
/var/www/goingplacesme/wp-content/uploads/nginx-helper/map.conf;
}

server {
       listen 80;
       listen [::]:80;

       root /var/www/exampleme;

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

       server_name example.me www.example.me;

       location / {
               #try_files $uri $uri/ =404;
               try_files $uri /index.php$is_args$args;
       }

       # pass the PHP scripts to FastCGI server listening on
127.0.0.1:9000
       location ~ \.php$ {
               include snippets/fastcgi-php.conf;

               # With php7.0-cgi alone:
               #fastcgi_pass 127.0.0.1:9000;
               # With php7.0-fpm:
               fastcgi_pass unix:/run/php/php7.0-fpm.sock;
       }

       # deny access to .htaccess files, if Apache's document root
       # concurs with nginx's one
       #
       #location ~ /\.ht {
       #       deny all;
       #}
       location ~ ^/files/(.*)$ {
         try_files /wp-content/blogs.dir/$blogid/$uri
/wp-includes/ms-files.php?file=$1 ;
         access_log off; log_not_found off; expires max;
       }

       location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
               expires 24h;
               log_not_found off;
       }

       location ^~ /blogs.dir {
               internal;
               alias /var/www/pathtoyoursite/web/wp-content/blogs.dir ;
               access_log off; log_not_found off;      expires max;
       }



       if (!-e $request_filename) {
               rewrite /wp-admin$ $<a href="scheme://$host$uri/" class="">scheme://$host$uri/ permanent;
               rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
               rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
       }

}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,280904,280904#msg-280904

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx

signature.asc (849 bytes) Download Attachment