Question

Transfer Wordpress Multisite from cpanel hosting to DO droplet.

Hi, I have a website (wordpress multisite) running on cpanel which i would like to move to digitalocean droplet. Ive tried it before but when all the db and files have been moved, i was not able to access all the multisites and also response time was way too much!

i want to know what would be the best way to host the multisite? would it be LAMP? or ubuntu? or what would be the best way to handle it?

i was unable to find any recent and relevant information on the internet hence posting it here. Thanks.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

# You may add here your
# server {
#	...
# }
# statements for each of your virtual hosts to this file

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

server {
	listen 80 default_server;
	listen [::]:80 default_server ipv6only=on;

	root /var/www/html;
	index index.php index.html index.htm;

	# Make site accessible from http://localhost/
	server_name localhost;

	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		# try_files $uri $uri/ =404;
		try_files $uri $uri/ /index.php?$args;
		# Uncomment to enable naxsi on this location
		# include /etc/nginx/naxsi.rules
	}

	error_page 404 /404.html;
	error_page 500 502 503 504 /50x.html;
	location = /50x.html {
		root /usr/share/nginx/html;
	}

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

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	#location ~ /\.ht {
	#	deny all;
	#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#	listen 8000;
#	listen somename:8080;
#	server_name somename alias another.alias;
#	root html;
#	index index.html index.htm;
#
#	location / {
#		try_files $uri $uri/ =404;
#	}
#}


# HTTPS server
#
#server {
#	listen 443;
#	server_name localhost;
#
#	root html;
#	index index.html index.htm;
#
#	ssl on;
#	ssl_certificate cert.pem;
#	ssl_certificate_key cert.key;
#
#	ssl_session_timeout 5m;
#
#	ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
#	ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
#	ssl_prefer_server_ciphers on;
#
#	location / {
#		try_files $uri $uri/ =404;
#	}
#}


server {

	root /var/www/html;
	index index.php index.html index.htm;

	# Make site accessible from http://localhost/
    server_name domain.com www.domain.com; # managed by Certbot


	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		# try_files $uri $uri/ =404;
		try_files $uri $uri/ /index.php?$args;
		# Uncomment to enable naxsi on this location
		# include /etc/nginx/naxsi.rules
	}

	error_page 404 /404.html;
	error_page 500 502 503 504 /50x.html;
	location = /50x.html {
		root /usr/share/nginx/html;
	}

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

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	#location ~ /\.ht {
	#	deny all;
	#}


    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/domain.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



}

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


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


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




}

here is my ngnix configuration… Now the website is showing 404 on all pages… If i restart the droplet then it starts working for 1 minute and then 404 again… should i move to apache? or am i missing something here? :(

Hello, @awaix

Thanks for getting back to me.

As you’re now with Nginx the .htaccess files will not work and you’ll need to sort out the rewrite for the internal pages directly from the Nginx config file for the domain name in question.

Can you please share your current nginx config file so I can check it for you? You need to make sure you have the following line in the nginx config:

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

or this one:

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

I usually prefer the second as it’s considered more precise. This should sort the issue with the permalinks for you.

Let me know how it goes.

Regards, Alex

while the website is in loading state if i run sudo systemctl restart nginx.service it loads the next request and shows the page fine… but then again same for next requests…

Ubuntu LEMP on 18.04 Size 2 vCPUs 4GB / 80GB Disk

fixed the 404 for a while… was able to do it by changing config in nginx file but now website keeps loading for few minutes and then sometimes it works and sometimes 404 error again… now even for the main website as well as for the main website backend… now i can barely access the wp-admin for the main website… ive checked the graphs on the digitalocean panel and there is no surge of resources…

i have no clue what is causing this now… any help??

Hello, @awaix

You can either create a LEMP droplet and then migrate your WordPress multisite over or use our WordPress 1-click installer - https://marketplace.digitalocean.com/apps/wordpress

The installer will deploy a LAMP server with everything needed for hosting a WordPress site. You can then copy your files over and configure the rest of the setup after the migration.

You’ve mentioned that in the past you were not able to access all multisites. Can you please let me know if you’re using the sub-directories option for multisite?

As for the response times, I will recommend you to monitor the droplet’s performance once you’ve migrated your site in order to see if the resources are enough (in case you’ve started with a small droplet). There might a memory exhaustion coming from a plugin or something else can be consuming the droplet’s resources so you will need to monitor the droplet’s performance while working on your site to see what’s going on.

You can always upgrade the droplet’s resources so this should not be an issue.

As for the Laravel Forge issue, when you say that you’ve experienced the same issues, do you mean that the response times were big?

I will recommend you to go with a LEMP droplet for the Laravel Forge installation.

You can follow this tutorial for installation Laravel: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-laravel-with-lemp-on-ubuntu-18-04

Hope this helps!

Regards, Alex

P.S i also have forge.laravel subscription… i tried setting up droplet using forge as well… same issue… i read somewhere about lamp installation instead of ubuntu install… so not sure what would work best