Talk about NGINX

Message
Author
User avatar
@ajaxStardust
Posts: 106
Joined: Thu Sep 23, 2021 2:18 am

Talk about NGINX

#1 Post by @ajaxStardust »

Code: Select all

System:
  Kernel: 6.5.0-1mx-ahs-amd64 [6.5.3-1~mx23ahs] arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.5.0-1mx-ahs-amd64 root=UUID=<filter> ro quiet splash
  Desktop: Xfce v: 4.18.1 tk: Gtk v: 3.24.36 info: xfce4-panel wm: xfwm v: 4.18.0 vt: 7
    dm: LightDM v: 1.26.0 Distro: MX-23.2_ahs_x64 Libretto October 15  2023 base: Debian GNU/Linux
    12 (bookworm)
Machine:
  Type: Desktop System: HP product: HP All-in-One 22-df0xxx v: N/A serial: <superuser required>
    Chassis: type: 13 serial: <superuser required>
  Mobo: HP model: 86F7 v: 0000 serial: <superuser required> UEFI: AMI v: F.40 date: 10/05/2023
CPU:
  Info: model: Intel Celeron G5905T bits: 64 type: MCP arch: Comet Lake level: v2 built: 2020
    process: Intel 14nm family: 6 model-id: 0xA5 (165) stepping: 3 microcode: 0xF8
  Topology: cpus: 1x cores: 2 smt: <unsupported> cache: L1: 128 KiB desc: d-2x32 KiB; i-2x32 KiB
    L2: 512 KiB desc: 2x256 KiB L3: 4 MiB desc: 1x4 MiB
  Speed (MHz): avg: 1100 min/max: 800/3300 scaling: driver: intel_pstate governor: powersave
    cores: 1: 1100 2: 1100 bogomips: 13199
  Flags: ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data mitigation: Clear CPU buffers; SMT disabled
  Type: retbleed mitigation: Enhanced IBRS
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Enhanced / Automatic IBRS, IBPB: conditional, RSB filling,
    PBRSB-eIBRS: SW sequence
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel CometLake-S GT1 [UHD Graphics 610] vendor: Hewlett-Packard driver: i915 v: kernel
    arch: Gen-9.5 process: Intel 14nm built: 2016-20 ports: active: eDP-1 empty: HDMI-A-1
    bus-ID: 00:02.0 chip-ID: 8086:9ba8 class-ID: 0300
  Device-2: Quanta HP TrueVision HD Camera type: USB driver: uvcvideo bus-ID: 1-6:5
    chip-ID: 0408:5365 class-ID: 0e02
  Display: x11 server: X.Org v: 1.21.1.7 with: Xwayland v: 22.1.9 compositor: xfwm v: 4.18.0
    driver: X: loaded: modesetting unloaded: fbdev,vesa dri: iris gpu: i915 display-ID: :0.0
    screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22") s-diag: 582mm (22.93")
  Monitor-1: eDP-1 model: HP ALL-in-One serial: <filter> built: 2019 res: 1920x1080 hz: 60
    dpi: 102 gamma: 1.2 size: 476x268mm (18.74x10.55") diag: 546mm (21.5") ratio: 16:9
    modes: 1920x1080
  API: OpenGL v: 4.6 Mesa 23.1.2-1~mx23ahs renderer: Mesa Intel UHD Graphics 610 (CML GT1)
    direct-render: Yes
Audio:
  Device-1: Intel Comet Lake PCH-V cAVS vendor: Hewlett-Packard driver: snd_hda_intel v: kernel
    alternate: snd_sof_pci_intel_cnl bus-ID: 00:1f.3 chip-ID: 8086:a3f0 class-ID: 0403
  API: ALSA v: k6.5.0-1mx-ahs-amd64 status: kernel-api tools: alsamixer,amixer
  Server-1: PipeWire v: 1.0.0 status: off with: 1: pipewire-pulse status: off 2: wireplumber
    status: off tools: pw-cat,pw-cli,wpctl
  Server-2: PulseAudio v: 16.1 status: active tools: pacat,pactl,pavucontrol
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Hewlett-Packard
    driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: 4000 bus-ID: 02:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: eth0 state: down mac: <filter>
  Device-2: Realtek RTL8821CE 802.11ac PCIe Wireless Network Adapter vendor: Hewlett-Packard
    driver: rtw_8821ce v: N/A modules: rtw88_8821ce,wl,rtl8821ce pcie: gen: 1 speed: 2.5 GT/s
    lanes: 1 port: 3000 bus-ID: 03:00.0 chip-ID: 10ec:c821 class-ID: 0280
  IF: wlan0 state: up mac: <filter>
  IF-ID-1: docker0 state: down mac: <filter>
Bluetooth:
  Device-1: Realtek Bluetooth 4.2 Adapter type: USB driver: btusb v: 0.8 bus-ID: 1-7:6
    chip-ID: 0bda:b00a class-ID: e001 serial: <filter>
  Report: hciconfig ID: hci0 rfk-id: 0 state: down bt-service: N/A rfk-block: hardware: no
    software: yes address: <filter>
  Info: acl-mtu: 1021:8 sco-mtu: 255:12 link-policy: rswitch hold sniff park
    link-mode: peripheral accept
RAID:
  Hardware-1: Intel SATA Controller [RAID mode] driver: ahci v: 3.0 port: 5060 bus-ID: 00:17.0
    chip-ID: 8086:2822 rev: class-ID: 0104
Drives:
  Local Storage: total: 715.41 GiB used: 59.27 GiB (8.3%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: MZVLQ256HAJD-000H1 size: 238.47 GiB
    block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
    rev: HPS4NFXV temp: 34.9 C scheme: GPT
  ID-2: /dev/sda maj-min: 8:0 type: USB vendor: TeamGroup model: TM8 FP6512G size: 476.94 GiB
    block-size: physical: 512 B logical: 512 B type: N/A serial: <filter> rev: 1.00 scheme: MBR
Partition:
  ID-1: / raw-size: 476.69 GiB size: 468.13 GiB (98.21%) used: 59.27 GiB (12.7%) fs: ext4
    dev: /dev/sda2 maj-min: 8:2
  ID-2: /boot/efi raw-size: 256 MiB size: 252 MiB (98.46%) used: 276 KiB (0.1%) fs: vfat
    dev: /dev/sda1 maj-min: 8:1
Swap:
  Kernel: swappiness: 15 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: file size: 3 GiB used: 936.6 MiB (30.5%) priority: -2 file: /swap/swap
Sensors:
  System Temperatures: cpu: 36.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Repos:
  Packages: 4277 pm: dpkg pkgs: 4270 libs: 1796
    tools: apt,apt-get,aptitude,gnome-software,nala,synaptic pm: rpm pkgs: 0 pm: flatpak pkgs: 7
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list
    1: deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/debian.list
    1: deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
    2: deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/megasync.list
    1: deb [signed-by=/usr/share/keyrings/meganz-archive-keyring.gpg] https://mega.nz/linux/repo/Debian_12/ ./
  Active apt repos in: /etc/apt/sources.list.d/microsoft-edge.list
    1: deb [arch=amd64] https://packages.microsoft.com/repos/edge/ stable main
  Active apt repos in: /etc/apt/sources.list.d/mx.list
    1: deb http://mirrors.rit.edu/mxlinux/mx-packages/mx/repo/ bookworm main non-free
    2: deb http://mirrors.rit.edu/mxlinux/mx-packages/mx/repo/ bookworm ahs
  Active apt repos in: /etc/apt/sources.list.d/onlyoffice.list
    1: deb https://download.onlyoffice.com/repo/debian squeeze main
  Active apt repos in: /etc/apt/sources.list.d/opera-stable.list
    1: deb https://deb.opera.com/opera-stable/ stable non-free
  Active apt repos in: /etc/apt/sources.list.d/sublime-text.list
    1: deb https://download.sublimetext.com/ apt/stable/
  Active apt repos in: /etc/apt/sources.list.d/vivaldi.list
    1: deb [arch=amd64] https://repo.vivaldi.com/stable/deb/ stable main
  Active apt repos in: /etc/apt/sources.list.d/vscode.list
    1: deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
  Active apt repos in: /etc/apt/sources.list.d/vscodium.list
    1: deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://paulcarroty.gitlab.io/vscodium-deb-rpm-repo/debs vscodium main
Info:
  Processes: 279 Uptime: 6h 9m wakeups: 1 Memory: 3.54 GiB used: 2.63 GiB (74.3%) Init: SysVinit
  v: 3.06 runlevel: 5 default: graphical tool: systemctl Compilers: gcc: 12.2.0 alt: 12
  Client: shell wrapper v: 5.2.15-release inxi: 3.3.26
Boot Mode: UEFI
I'm not sure which forum/ topic/ group/ category sub-x it belongs in. Please move for moderation if appropriate. I'm pretty happy with my current MX-23 setup! Typically, I'd be complaining by now, not having my own PC setup etc, but being away from home I was able to install MX-23 on an external SSD (USB-C but actually connected via USB [usb3 i presume]). it's pretty groovy. I can't complain! Posting this question here, since i'm working under MX-23.

Honestly I realize it's an NGINX question specifically. I was coming to ask if you might recommend a preferred site where I should present this question. I really try to stay away from Stack-Exchange/ Stack-Overflow because i find the miserable people and useless information simply intolerable in my old age.

In my spare time I've been working to learn how to use Laravel
(Laravel == a PHP Framework/ Obj Relation Mapper) installable via composer. the link provided isn't all that helpful IMO, but it's the official resource. i'm afraid their doc needs improving).

It's not super easy to get Laravel to function, but not terribly difficult. I'm honestly not a big fan of NPM and Composer, and the like, but it is what it is. It makes sense that things have gone that direction (e.g. Open Source, collaboration, GitHub, maturation of libraries and frameworks, packages, package mgt, etc.). blah blah.

To me working in Laravel: i feel like I want to have a "clean server". That is, as if to imagine this is what would be deployed in E.g. a remote ./public_html container on some hosted, registered domain name... I can do web apps in sub folders all day long under a basic /var/www/html path, but i want to get beyond that kind of "Tonka toys presents: my first HTTP sandbox dump truck!" sort of thing which is easy to configure in and of itself, as it doesn't beg for much learning (at least for me, at this point...)

I've come to like using NGINX. I've admin servers w/ Apache2 for roughly 20 years. I get by on Apache from what I consider pretty basic knowledge, but years of experience. NGINX seems easier to me, so I've been playing with it primarily lately.

NGINX and

Code: Select all

server { ...paths... }
Let's assume I use /var/www/html for everything when I'm working on web dev stuff "locally" (or on localhost). Branching out, I want to put a Laravel installation in a separate "virtual host" (as Apache would name it, I believe). so, working with

...assume the complete ./config.d/nginx.site.conf code is there. just sharing parts for discussion:
Basic PHP/HTML path

Code: Select all

# NGINX MAYBE root directive
# Assuming dir for most basic or default install
root /var/www/html;
...
server_name mx23ahs;
Laravel Site

Code: Select all

# NGINX MAYBE root directive
# assuming dir for a laravel install
root /var/www/laravel;
...
server_name mylaravel;
Python Site

Code: Select all

# NGINX MAYBE root directive
# assuming dir for a flask install
root /var/www/python;
...
server_name mypython;
Etc.

My conundrum. I can get those "virtual host" sites to function in the browser, using paths like http://mylaravel/public/path.html E.g. as designated, but if something causes the browser to follow a URL path resulting in the browser going to "localhost", literally: http://localhost/public/path.html -- maybe javascript did that, or maybe a path stored in the database... who knows! i don't think it matters.

If "all" of my "sites" are under /var/www/html. Some things I click on direct the browser to "localhost", which might serve files from

Code: Select all

/var/www/laravel
instead of

Code: Select all

/var/www/html
I'd been struggling with that for a couple of days, but finally got it to function as I wish. E.g. I can point the browser to http://mylaravel/site.php and i get what I expect,

Code: Select all

 # as well as 
http://mx23ahs/site/path.html 
# where 
http://localhost/site/path.html 
# is also served, and is 
# the same file served. 
I've looked at several different references regarding NGINX "serving the wrong site" or some variance thereof, mostly in stackoverflow but I don't feel satisfied with what i've assimilated. Eg. honestly, I've been studying it, and couldn't determine why I couldn't get it to "work", then after reformatting the code in VS Code (format document > nginx formatter), somehow it started working. maybe I robotically changed something. If I did, I don't know what, but it functions now.

that is to say both of these conf are enabled and functioning correctly (i think):

Code: Select all

server {

    listen 80;
    root /var/www/laravel;
    server_name mylaravel;

    index index.php index.phtml index.html index.htm;

Code: Select all

server {

        listen 80;
		listen [::]:80;
        root /var/www/html;        
        
        server_name mx23ahs;
        # server_name localhost;
        
        index index.php index.phtml index.html index.htm;
i get that listen [::]:80 is for ipv6 etc.
What I don't get is why my server had been serving only /var/www/laravel files when I pointed the browser to http://localhost vs http://mx23ahs/

again. by all means, if you have a suggested forum for addressing that question, please share. if you can help me to understand right here it would be great too!

EDIT: in Attempt to clarify.
What I'm trying to understand is why NGINX will serve a particular path instead of the other, when the browser is pointed to "localhost" (or 127.0.0.1) yet NONE of my sites actually indicate "server_name localhost;"
When I state above that "it's functioning correctly", I simply mean it's doing what I want. But I don't think it's correct. It just happens to be working.

Maybe you know of a URL with a good tutorial for learning that aspect of it. Thank you!
Check some old recordings feat me on guitar (acct is dude censored face) at: SoundCloud com /ajaxStardust+
on the Don: vivaldi social /@ajaxStardust

User avatar
CharlesV
Administrator
Posts: 7967
Joined: Sun Jul 07, 2019 5:11 pm

Re: Talk about NGINX

#2 Post by CharlesV »

If you have not already seen these, possibly something in one of these might help?

https://webdock.io/en/docs/how-guides/l ... full-guide

https://laravel.com/docs/10.x/homestead#main-content
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

Post Reply

Return to “Chat”