Question

How To Install WordPress on Ubuntu 22.04 with a Apache2 and Nginx?

How do I configure wordpress, apache2 and nginx for maximum speed? I followed this tutorial: https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-web-server-and-reverse-proxy-for-apache-on-one-ubuntu-20-04-server

Unfortunately wordpress only works on port 8080, and Nginx reports a 404 error on port 80.


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Hi there,

It sounds like that your Nginx server block might not be correct. You need to define your server_name so it matches your domain name and also you need to make sure that the proxy_pass rule is correctly set to the Apache backend service.

Here is an example:

server {
  listen 80;
  server_name yourdomain.com www.yourdomain.com;

  # global gzip on
  gzip on;
  gzip_min_length 10240;
  gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
  gzip_disable "MSIE [1-6]\.";

  add_header Cache-Control public;

  location / {
    proxy_pass http://127.0.0.1:8080; # change this
    proxy_buffering on;
    proxy_buffers 12 12k;
    proxy_redirect off;

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
  }


}

Also make sure that if you are using your server IP address, to delete the default Nginx server block so that it does not cause any conflicts.

If it is still not working, feel free to share your Nginx server block here.

Best,

Bobby