linux – Losing my mind trying to get a CGI script to execute instead of download using Nginix and Ubuntu 20.04

I cannot get a CGI script to execute itself instead of opening up a download window, do I need to add something indicating it should be inline? I’ve been trying for about two days and I’m stuck so any help would be greatly appreciated. I’m trying to avoid using JS.

I created a test script and got the same result as my written script, so I don’t think it’s my script. Here’s the test that I ran:

#!/usr/bin/env bash
echo "Content-type: text/html"
echo ""
now="$(date)"
echo '<html><head><title>Hello World - CGI app</title></head>'
echo '<body>'
 
echo '<h2>Hello World!</h2>'
echo "Computer name : $HOSTNAME<br/>"
echo "The current date and time : ${now}<br/>"
echo '</body>'
echo '</html>'

My fcgiwrap.config is as follows and is activated and running:

location /cgi-bin/ {
  # Disable gzip (it makes scripts feel slower since they have to complete
  # before getting gzipped)
  gzip off;

  # Set the root to /usr/lib (inside this location this means that we are
  # giving access to the files under /usr/lib/cgi-bin)
  # change
  root  /var/www;

  # Fastcgi socket
  fastcgi_pass  unix:/var/run/fcgiwrap.socket;

  # Fastcgi parameters, include the standard ones
  include /etc/nginx/fastcgi_params;

  # Adjust non standard parameters (SCRIPT_FILENAME)
  # change
  fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;

My sites-available default is set up like this:

# Default server configuration
#
server {
        listen 80 default_server;
        listen (::):80 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen (::):443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;
        root /var/www/;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;

 include fcgiwrap.conf;
 }

My fgciwrap.socket is configured:

(Unit)
Description=fcgiwrap Socket

(Socket)
ListenStream=/run/fcgiwrap.socket

(Install)
WantedBy=sockets.target

My fgciwrap.service is set up:

(Unit)
Description=Simple CGI Server
After=nss-user-lookup.target
Requires=fcgiwrap.socket

(Service)
EnvironmentFile=/etc/sysconfig/fcgiwrap
ExecStart=/usr/sbin/fcgiwrap ${DAEMON_OPTS} -c ${DAEMON_PROCS}
User=nginx
Group=nginx

(Install)
Also=fcgiwrap.socket

20.04 – Ubuntu doesn’t like

bash debconf-set-selections <<< "postfix postfix/mailname string myname.com" && debconf-set-selections <<< "postfix postfix/main_mailer_type string Internet with smarthost" && apt-get install -y mailutils && apt-get install -y sasl2-bin
Syntax error: redirection unexpected

Does anyone know how I can insert values into debconf-set-selections without using <<<? It seems like ubuntu does not like this. I’ve also tried using bash but it does not work as well.

networking – Netplan/Network backend in Ubuntu 20.04 LTS

Hope everyone is doing good.

My server is configured with static IP using netplan. I’m confused about the ubuntu 20.04LTS server network backends.

  • According to the Netplan Documentation netplan default beckend is systemd-networkd and default renderer is networkd unless changed to NetworkManager.
  • Network should stop working if I stop network service.
  • To day I have turned off all network related services for testing purpose one by one(network.target systemd-networkd.service systemd-networkd.socket networkd-dispatcher.service systemd-networkd-wait-online.service network-online.target network-pre.target)
    but still I can ping and ssh the machine.

Can any one help me to understand this behaviour of networking and what backend service is controlling the networking.

Thanks

How to upgrade GNOME in Ubuntu 20.04?

I’m currently using Ubuntu 20.04 LTS with Gnome 3.36.8. But I like the new GNOME 40 look. I’ve been using this system for almost 2 years, and I’ve many programs installed here and everything set up the way I want to. So, is there a way to upgrade my GNOME to the new version?
Thank you.

No line in sound on ubuntu 20.04

I suddenly got no sound using the line-in on my laptop, and I do not know why. I know this isn’t a hardware issue, because the line-in worked fine when booting from a usb. Restarting pulse and alsa did nothing, and using alsamixer did not help as well. Any help will be greatly appreciated!

20.04 – No Bluetooth Found. Plug in a dongle to use bluetooth

I am new to Ubuntu (and to the whole world of Linux) and am using Ubuntu 20.04. I have completely uninstalled windows and installed Ubuntu on my system. Now when I go to the settings to connect to Bluetooth, this is what it shows me
enter image description here

Earlier, when I was using windows, Bluetooth would occasionally cause problems but would work just fine most of the time.

Could someone please help me with this issue as I have my classes going online and have to use my Bluetooth headset.
Thanks in advance for what I know is going to be a very helpful answer.

nvidia – How to install Cuda Toolkit Version 11.1 on Ubuntu 20.04?

I am trying to install cuda toolkit version 11.1 on Ubuntu 20.04 because a neural network I’m using is only compatible with cuda version 11.1, however, the latest version is 11.3. Is there anyway I can install version 11.1 (Haven’t installed cuda yet, nvidia driver: 460.73.01).

boot – Multiply claimed blocks repeating themselves with no end I can see they are game files what do I do 20.04 I have tried multiple times to fix it reins


Your privacy


By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.




20.04 – Trackpad non-functional on x360 hp pavilion laptop

I am using an x360 hp pavilion laptop, Ubuntu 20.04 LTS, kernel version (from uname -r) is 5.8.0-55-generic.

sudo dmidecode | grep -A3 '^System Information'

System Information
    Manufacturer: HP
    Product Name: HP Pavilion x360 Convertible 14m-dw1xxx
    Version: 

The touchpad is completely unresponsive, however, the keyboard works just fine.
I have ran sudo apt install xserver-xorg-input-all. The output of xinput is as follows:

⎡ Virtual core pointer                      id=2    (master pointer  (3))
⎜   ↳ Virtual core XTEST pointer                id=4    (slave  pointer  (2))
⎜   ↳ ETPS/2 Elantech Touchpad                  id=8    (slave  pointer  (2))
⎜   ↳ BT5.1 Mouse                               id=9    (slave  pointer  (2))
⎣ Virtual core keyboard                     id=3    (master keyboard (2))
    ↳ Virtual core XTEST keyboard               id=5    (slave  keyboard (3))
    ↳ HP Wide Vision HD Camera: HP Wi           id=6    (slave  keyboard (3))
    ↳ AT Translated Set 2 keyboard              id=7    (slave  keyboard (3))
    ↳ Indy Fuel (AVRCP)                         id=10   (slave  keyboard (3))

As suggested here, I have edited /etc/default/grub to contain quiet splash acpi=off, with no effect. If there is any relevant information that I have forgot to include, please tell me. (Currently using a bluetooth mouse.)

networking – How to add persistent IP routes in Ubuntu 20.04 server

Maybe this question has been answered somewhere before but I can’t seems to figure it out as yet.
Lately I’m having some issues with my Ubuntu 20.04 server.
I installed OpenVPN and I can successfully create a vpn tunnel with NordVPN. Problem is that when the tunnel is created the connection breaks down and I cannot ssh back into the server unless I add some ip routes. I found a solution for this:
Assuming the server real ip is 185.230.125.107, I manually added the routes as follows:

sudo ip rule add from 185.230.125.107 table 128;
sudo ip route add table 128 185.230.125.107/32 dev eno0;
sudo ip route add table 128 default via 185.230.125.254;

This works fine until reboot. After the machine restarts, I have to add those rules back in again.
My question is this:
How would I add these rules, making them persistent so at reboot they stay in place!? Where and how should I add them!? I read somewhere that I need to create some sort of a script in /etc/network/if-up.d but I have no idea how to make such a script.
Please, is somebody willing to help!? I’d really appreciate that guys.
Many thanks
Nick