Skip to content

configure ghost and wordpress combo

Moved Solved WordPress
  • 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?

  • phenomlabundefined phenomlab moved this topic from Networks on
  • 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.

  • Hariundefined Hari has marked this topic as solved on
  • @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?
Did you find the suggested solution useful? Why not buy me a coffee? It's a nice gesture, and a great way to show your appreciation 💗

Related Topics
  • 3 Votes
    6 Posts
    579 Views

    @DownPW said in Nginx core developer quits project in security dispute, starts “freenginx” fork:

    Maybe virtualmin implement it in the future…

    I don’t think they will - my guess is that they will stick with the current branch of NGINX. I’ve not personally tested it, but the GIT page seems to be very active. This is equally impressive

    8ac0d197-68fa-4bd8-bfa3-87237bf8f1f4-image.png

    I think the most impressive on here is the native support of HTTP 3

  • Error certification on virtualmin/Nginx

    Solved Linux
    17
    0 Votes
    17 Posts
    739 Views

    @DownPW anytime

  • WP / Woocommerce Mystery

    Solved Configure
    23
    12 Votes
    23 Posts
    1k Views

    @Panda said in WP / Woocommerce Mystery:

    Just back to my other question, have you ever used Shopify?
    It insists on a templating language to use any custom js.

    Not personally as never had any need, however, I do know that it uses Liquid for JS templating. It’s written in Ruby and is used to generate dynamic content on shop fronts. There’s zero reason as to why it wouldn’t work with data supplied by 3rd party API’s, although WordPress code won’t natively work for obvious reasons, and as such, this code would need to be re-written.

    The JS part will likely work with minor modification, but not the PHP file in it’s current form.

  • Is nginx necessary to use?

    Moved Solved Hosting
    2
    1 Votes
    2 Posts
    373 Views

    @Panda said in Cloudflare bot fight mode and Google search:

    Basic question again, is nginx necessary to use?

    No, but you’d need something at least to handle the inbound requests, so you could use Apache, NGINX, Caddy… (there are plenty of them, but I tend to prefer NGINX)

    @Panda said in Cloudflare bot fight mode and Google search:

    Do these two sites need to be attached to different ports, and the ports put in the DNS record?

    No. They will both use ports 80 (HTTP) and 443 (HTTPS) by default.

    @Panda said in Cloudflare bot fight mode and Google search:

    Its not currently working, but how would the domain name know which of the two sites to resolve to without more info?
    Currently it only says the IP of the whole server.

    Yes, that’s correct. Domain routing is handled (for example) at the NGINX level, so whatever you have in DNS will be presented as the hostname, and NGINX will expect a match which once received, will then be forwarded onto the relevant destination.

    As an example, in your NGINX config, you could have (at a basic level used in reverse proxy mode - obviously, the IP addresses here are redacted and replaced with fakes). We assume you have created an A record in your DNS called “proxy” which resolves to 192.206.28.1, so fully qualified, will be proxy.sudonix.org in this case.

    The web browser requests this site, which is in turn received by NGINX and matches the below config

    server { server_name proxy.sudonix.org; listen 192.206.28.1; root /home/sudonix.org/domains/proxy.sudonix.org/ogproxy; index index.php index.htm index.html; access_log /var/log/virtualmin/proxy.sudonix.org_access_log; error_log /var/log/virtualmin/proxy.sudonix.org_error_log; location / { proxy_set_header Access-Control-Allow-Origin *; proxy_set_header Host $host; proxy_pass http://localhost:2000; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Api-Key $http_x_api_key; } location /images { index index.php index.htm index.html; root /home/sudonix.org/domains/proxy.sudonix.org/ogproxy; } fastcgi_split_path_info "^(.+\.php)(/.+)$"; listen 192.206.28.1:443 ssl http2; ssl_certificate /home/sudonix.org/domains/proxy.sudonix.org/ssl.combined; ssl_certificate_key /home/sudonix.org/ssl.key; }

    The important part here is server_name proxy.sudonix.org; as this is used to “map” the request to the actual domain name, which you can see in the root section as root /home/sudonix.org/domains/proxy.sudonix.org/ogproxy;

    As the DNS record you specified matches this hostname, NGINX then knows what to do with the request when it receives it.

  • How to fix no img attribute from this code

    Solved WordPress
    7
    1 Votes
    7 Posts
    332 Views

    Yes, I am aware that if users are given the option to enter alt text, some may do so in an abusive manner. For the time being, we’ve adjusted the php script to generate the alt automatically, thus there are no longer any SEO problem with alt images.

  • Flarum - WordPress Journey

    WordPress
    59
    22 Votes
    59 Posts
    5k Views

    @Sala I will likely need admin access to your site for this.

  • move out from flarum to wordpress

    WordPress
    87
    52 Votes
    87 Posts
    9k Views

    @Hari Glad to see this went so well, and that you’ve finally departed the Flarum ecosystem 🙂

  • 1 Votes
    2 Posts
    320 Views

    @hari the cache level for woocommerce should always be bypass. Any caching of woocommerce will cause you serious issues and will result in the checkout process not functioning correctly.

    This does mean that the overall experience will be slower (depending on geographic location) although CF is known to cause significant issues hence the need to bypass.

    If you want to cache as much as possible, then set rules to bypass caching on the cart and account pages etc.