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

Demistify Buffer Overflow Vulnerability

Collection of articles, blog posts, lectures, tutorials... about Buffer Overflow Vulnerability.

Check and install php7.0-mbstring extention on Ubuntu 16.04 and Microsoft Windows

While learning Facebook SDK for PHP I overlooked one of system requirements preventing my code from running on my host. That is The mbstring extension. Facebook SDK for PHP's system requirements Check if mbstring is enabled root@ubuntu001:~# php -a Interactive mode enabled php > echo extension_loaded('mbstring'); php >exit root@ubuntu001:~# apt-cache search php7 | grep mbstring php7.0-mbstring - MBSTRING module for PHP root@ubuntu001:~# Install php7.0-mbstring root@ubuntu001:~# apt-get install php7.0-mbstring Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required:   fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0   libjpeg-turbo8 libjpeg8 libmcrypt4 libtiff5 libvpx3 libxpm4 Use 'apt autoremove' to remove them. The following additional packages will be installed:   libapache2-mod-php7.0 php7.0-cli ph...

Microsoft Windows Server 2012 R2 Standard Evaluation Product Key

Microsoft Windows Server 2012 R2 Standard Evaluation D2N9P-3P6X9-2R39C-7RTCD-MDVJX DBGBW-NPF86-BJVTX-K3WKJ-MTB6V