0

I migrated my WordPress websites from shared hosting to a single VPS. I am hosting the websites with a Plesk server. The Plesk is configured to serve the request with an Apache web server and Nginx as a reverse proxy server.

Now, I want to host a static website with Nginx at /var/www/bloggrammer.com. I have added the nginx config for the static website at /etc/nginx/sites-available and enabled it at /etc/nginx/sites-enabled. I removed the default config file /etc/nginx/sites-available/default and change the port number in /etc/nginx/sites-available/bloggrammer from 80 to 8080 because apache is already using the default port, 80.

Below is my config file:

server {
    listen *:8080;
    listen [::]:8080;

    server_name bloggrammer.com;
    root /var/www/bloggrammer.com;

    location / {
        index index.html;
    }
}

When I restart nigix using systemctl restart nginx I get the following error:

Job for nginx.service failed because the control process exited with an error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.

I ran nginx -t for a syntax error in the configuration and I got this:

nginx: [emerg] unknown directive "brotli" in /etc/nginx/conf.d/brotli.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed

I ran systemctl status nginx.service and get the following:

nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2023-01-20 08:12:27 UTC; 16min ago
       Docs: man:nginx(8)
    Process: 1793904 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

How can I host the static website with Nginx while still having my WordPress websites running on Apache with Plesk?

PS: I am new to Linux machines and VPS hosting. Thank you in advance

3
  • 1
    You don't need another http server on top of Apache httpd. It won't make the site faster. I would focus on configuring Apache correctly instead. Commented Jan 21, 2023 at 11:01
  • The Nginx is serving static resources.
    – crammer
    Commented Jan 22, 2023 at 2:58
  • 1
    which can be done equally with Apache HTTPD. You are basically adding an additional step in exchange for no gain. Commented Jan 24, 2023 at 15:28

1 Answer 1

1

The solution is that you do not need any modifications to the files on the system, but simply uncheck the "Proxy mode" checkbox in "Apache and Nginx settings" dialog page for the domain in Plesk. This will make your website served by Nginx only. It is really that simple with Plesk: Just uncheck the box and that one domain will be served by Nginx only.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .