Thanks for your inputs ♥️
-
Hello, I am trying to configure Ghost and WordPress, but I’m stuck on the Nginx configuration and SSL setup. With the help of ChatGPT, I installed PHP 8.3 and WordPress, but when I access wp.domain.com, it still loads domain.com (Ghost). I think I may have made a mistake somewhere. Where should I check for the issue?
-
Did you also add wp.domain.com as an A record in your domain registry to point to your server IP? There are probably other ways of doing this as well. Whether you are using the DNS on the hosting provider to manage your dns or you go to where you have your domain registered, there you can usually add the wp.domain.com as an A record pointing to your server’s public IP address. Then it may take a little time for that to propagate out so you can ping wp.domain.com and see the ip address you added. I apologize if this sounds a little confusing.
I usually have it setup in it’s own .conf file with the root entry pointing/to/your/folder.
So example you have:
server { listen 80; server_name wp.domain.com; root /path/to/your/subdomain/folder Then the rest of your setup here . . . }
Then don’t forget to use
sudo ln -s /etc/nginx/sites-available/yourfilename.conf /etc/nginx/sites-enabled/yourfilename.conf
You will also need to restart your nginx server
sudo systemctl restart nginx
If you want to post your conf file we can take a look at it as well.
-
@Hari do you have seperate
nginx.conf
does for each domain? -
-
Did you also add wp.domain.com as an A record in your domain registry to point to your server IP? There are probably other ways of doing this as well. Whether you are using the DNS on the hosting provider to manage your dns or you go to where you have your domain registered, there you can usually add the wp.domain.com as an A record pointing to your server’s public IP address. Then it may take a little time for that to propagate out so you can ping wp.domain.com and see the ip address you added. I apologize if this sounds a little confusing.
I usually have it setup in it’s own .conf file with the root entry pointing/to/your/folder.
So example you have:
server { listen 80; server_name wp.domain.com; root /path/to/your/subdomain/folder Then the rest of your setup here . . . }
Then don’t forget to use
sudo ln -s /etc/nginx/sites-available/yourfilename.conf /etc/nginx/sites-enabled/yourfilename.conf
You will also need to restart your nginx server
sudo systemctl restart nginx
If you want to post your conf file we can take a look at it as well.
-
-
@Madchatthew, thanks! I’ve set up Nginx and added SSL for both domains.
At first, I used DigitalOcean’s one-click setup to install Ghost on domain.com. Later, I also installed Ghost on domain2.com, and that worked without any issues.
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 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.
-
@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.
-
Another thing I thought of, is make sure to install all of the php extension for Nginx. Below is a link to the php extensions you will want to install as well. You will want the highly recommended and I usually will install the suggested as well.
https://make.wordpress.org/hosting/handbook/server-environment/#php-extensions
Also remember if you make changes to restart php-fpm service and nginx service.
-
@Madchatthew even if @Hari has abandoned his attempts, this additional information you’ve provided is very useful for someone else who may find themselves in a similar situation.
Thanks
-
@phenomlab You are welcome. I had thought if I should post or not in regards to his reply but thought just in case if he tries it again. But I am stubborn and will keep trying until I force it to work haha. If anyone has the same issue, hopefully this will help.
-
@Madchatthew I’d always post for the reasons I stated above. It’s useful information and could save someone else the headache.
Did this solution help you?
Related Topics
-
-
-
-
-
nginx can't start again
Moved Solved Configure -
-
nginx seo urls
Solved Configure -
WordPress & NodeBB
Solved WordPress