Skip to main content

nginx on Ubuntu

nginx - HTTP and reverse proxy server, mail proxy server.

Install: sudo apt install nginx
Install: sudo apt install nginx

Check version: nginx -v
Check version: nginx -v

/etc/nginx/nginx.conf

events {
    work_connections    1024;
}

http {
    # Hide version
    server_tokens    off;
    # Enable gzip compression
    gzip    on;
    # Enable cache
    expires    365d;

    server {
        listen    80;
        server_name    localhost;

        location / {
            root html;           
        }
        
        # PHP-CGI configuration
        location ~ \.php$ {
            fastcgi_pass    127.0.0.1:9000;
            fastcgi_index   index.php;     
            fastcgi_param   SCRIPT_NAME    $document_root$fastcgi_script_name;
            include         fastcgi_params; 
        }

    }
}

sudo apt update
sudo apt install -y nginx : Install nginx

nginx -v : Check nginx version
nginx -V : Check nginx version, compiler version, and configure script parameters

/etc/nginx/nginx.conf : nginx default configuration file
/var/log/nginx/ : nginx default log directory

Errors

sudo apt update

nginx N: Skipping acquire of configured file 'nginx/binary-i386/Packages' as repository 'http://nginx.org/packages/mainline/ubuntu bionic InRelease' doesn't support architecture 'i386'

Edit /etc/apt/sources.list file

# deb https://nginx.org/packages/mainline/ubuntu/ bionic nginx
# deb-src https://nginx.org/packages/mainline/ubuntu/ bionic nginx
deb [arch=amd64] https://nginx.org/packages/mainline/ubuntu/ bionic nginx
deb-src [arch=amd64] https://nginx.org/packages/mainline/ubuntu/ bionic nginx

Popular posts from this blog

Powershell: Test-NetConnection

PS C:\Users\tuyen> get-help Test-NetConnection NAME     Test-NetConnection SYNTAX     Test-NetConnection [[-ComputerName] <string>] [-TraceRoute] [-Hops <int>] [-InformationLevel {Quiet |     Detailed}]  [<CommonParameters>]     Test-NetConnection [[-ComputerName] <string>] [-CommonTCPPort] {HTTP | RDP | SMB | WINRM}     [-InformationLevel {Quiet | Detailed}]  [<CommonParameters>]     Test-NetConnection [[-ComputerName] <string>] -Port <int> [-InformationLevel {Quiet | Detailed}]     [<CommonParameters>]     Test-NetConnection [[-ComputerName] <string>] -DiagnoseRouting [-ConstrainSourceAddress <string>]     [-ConstrainInterface <uint32>] [-InformationLevel {Quiet | Detailed}]  [<CommonParameters>] ALIASES     TNC REMARKS     Get-Help cannot find the Help files fo...

Powershell: Get-ChildItem

List, search/find files and directories with Get-ChildItem cmdlet.

Viber: Notes