I need to use nginx on the CyberPanel

Hi, I want to use Cyberpanel to host my wordpress site and peertube. I wonder if I can install Nginx on this server, which also runs Cyberpanel?

I am new to set up servers. I search Cyberpanel docs as well as this forum. Haven’t find any related topics.

I tried to install nginx, but it failed:

sudo systemctl status nginx

× 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 Sat 2023-09-09 00:30:45 UTC; 10s ago
Docs: man:nginx(8)
Process: 138359 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 138360 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
CPU: 9ms

Sep 09 00:30:43 localhost systemd[1]: Starting A high performance web server and a reverse proxy server…
Sep 09 00:30:43 localhost nginx[138360]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Sep 09 00:30:43 localhost nginx[138360]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Sep 09 00:30:44 localhost nginx[138360]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Sep 09 00:30:44 localhost nginx[138360]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Sep 09 00:30:45 localhost nginx[138360]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Sep 09 00:30:45 localhost nginx[138360]: nginx: [emerg] still could not bind()
Sep 09 00:30:45 localhost systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Sep 09 00:30:45 localhost systemd[1]: nginx.service: Failed with result ‘exit-code’.
Sep 09 00:30:45 localhost systemd[1]: Failed to start A high performance web server and a reverse proxy server.


Here is information about my server:

  • Post your server os version : Ubuntu 22.04 LTS
  • Post the details of my cyberpanel version:

Current Version:
2.3
Build:
4
Current Commit:
d65b6b5bcd4e89ce1a0eeb74131f98093e85bb3a
Latest Version:
2.3
Latest Build:
4
Latest Commit:
d65b6b5bcd4e89ce1a0eeb74131f98093e85bb3a

you must configure nginx to a different port than 80 and reverse proxy litespeed/ols to nginx port

Thanks for your tips.

Other than configure a different port, what else do I need to do? Do I need to do anything for the peertube, the website use Nginx?

Yes, your website uses nginx as backend and ols as frontend

1 Like

What is ols? :cowboy_hat_face:

OpenLiteSpeed

1 Like

I searched online about how to

It almost all mentioned:

server {
listen 80 default_server;
listen [::]:80 default_server;

But when I run ‘vi /etc/nginx/nginx.conf’

There is no such line in this file.

#mail {

# See sample authentication script at:

# Using a PHP Script on an Apache Server as the IMAP Auth Backend | NGINX

# auth_http localhost/auth.php;

# pop3_capabilities “TOP” “USER”;

# imap_capabilities “IMAP4rev1” “UIDPLUS”;

server {

listen localhost:110;

protocol pop3;

proxy on;

}

server {

listen localhost:143;

protocol imap;

proxy on;

}

#}

Do I simply add those lines in?

I am really new to self-hosting. Can anyone please tell me how can I config Nginx on CyberPanel?

Thanks in advance.

probably your nginx installation created a default host in another configuration file,

normally nginx do includes like conf.d/* or sites-enabled/*.conf
normally nginx for default creates default host at port 80 named default or default.conf in included directories,
if you erase that should work or you’re closer, main.conf is just an entrypoint of nginx configuration,

i asume that but when have trouble like that paste all the config directory or information you can provide please with credentials or sensible information erased or completly changed if have to not imagine things that can be changed depending in distribution, version or because you like another name for reason x, or try in local environment if someone need to help you, this is not a complete nginx.conf,

you can do nginx -T | grep "listen" | grep "80" at the command line to print all the configuration of nginx with included files and search if anything is calling port 80 binding

Regards,