@Hari said in configure ghost and wordpress combo:
But when I tried setting up wp.domain.com for WordPress, it kept redirecting to domain2.com instead of wp.domain.com after doing all the ngnix settings.
I might have more detail that you need, but I am not sure how your setup is currently. So I intend no offense if I am describing things in more detail than you need.
So are you controlling your DNS records through DigitalOcian or through the company that you purchased your domain name through? Which ever way you are managing your DNS, you will need to add an A record wp.domain.com that points to your serverās IP address, and a CNAME for www.wp.domain.com that points to your wp.domain.com A record. You would set this up just like you did for the main domains, but the subdomain is in with the rest of the DNS settings that you have your domain.com.
When you are setting up Nginx conf file for wp.domain.com (this should be itās own conf file), you do need some extra settings in there in order for Nginx to work with Wordpress.
Depending on where you are storing your wordpress files, /var/www/domain.com as an example, you will need php-fpm installed and running on the server as well. To see if you have that installed you can type the following:
sudo systemctl status php-fpm
If you get a message saying that it isnāt installed, you will need to install it and start and enable the service.
You will also need to add the following code to your wp.domain.com conf file.
server {
listen 80;
server_name wp.domain.com www.domain.com;
root /path/to/subdomainfolder;
index index.php index.html index.htm;
access_log /var/log/nginx/wp.domain.com.access.log;
error_log /var/log/nginx/wp.domain.com.error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri $document_root$fastcgi_script_name =404;
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_pass unix:/path/to/php-fpm.sock; # This is usually /run/folder/path
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_cache WORDPRESS;
fastcgi_cache_valid 200 60m;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|> expires max;
log_not_found off;
access_log off;
}
set $skip_cache 0;
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
if ($request_uri ~* "/wp-admin/|/wp-login.php") {
set $skip_cache 1;
}
}
The above is what I have for one of the wordpress sites I manage.
@Hari said in configure ghost and wordpress combo:
I gave up on that setup and tried installing WordPress on another droplet with a LEMP stack, but I ran into an issue with the upload file size limit. I might chose to Hostinger for hosting WordPress instead.
The upload size limit is kept in your php.ini file. It is under max_upload_size or something like that. You will also want to change your post_max_size and one other one that is similiar to that, that I canāt remember the name of. You could put in like 200 M or less or more if you wanted. That will be like that no matter what stack you are using or which hosting service you are using. Even if you are using Virtualmin you will need to make that change in the php.ini for that website.
I hope this helps you out. You can always give us a description of your site and post your config files along with you Nginx conf files for your sites and we can see and hone in on what may be happening and why it isnāt routing like it should.