Score:0

I to host a static website with nginx on Plesk server which is running Apache

dz flag

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

ezra-s avatar
ru flag
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.
crammer avatar
dz flag
The Nginx is serving static resources.
ezra-s avatar
ru flag
which can be done equally with Apache HTTPD. You are basically adding an additional step in exchange for no gain.
Score:1
lt flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.