Yuav tsim lub web server yooj yim li cas nrog 5 kab ntawm bash

Cov hnub blog tau zoo me ntsis nrog lub ncauj lus ntawm cov servers, peb tus phooj ywg Fico tau muab cov lus qhuab qhia rau peb hauv computer network hauv nws cov koob. Computer Networks rau cov SMEs, ntxiv rau ob peb cov ntawv sau los nruab thiab teeb tsa lub web servers nyob rau hauv Yuav ua li cas rau nruab thiab teeb tsa XAMPP ntawm GNU / Linux y Yuav ua li cas rau nruab NGINX nrog Google Page Speed ​​ntawm Ubuntu txiav.

Yuav ua li cas lub ntiaj teb ntawm software dawb yog li nurtured, qee zaum yooj yim thiab lwm lub sijhawm me ntsis ntau dua, hnub no peb coj koj txoj kev sim me me 5-kab, uas tso cai rau peb los tsim cov web server yooj yim.

Ntxhoo

Ntxhoo yog lub npe ntawm qhov sim tau los ntawm Ben raady thiab tias nws tau faib khoom pub dawb, nws yog qhov ua tau zoo li nws yog qhov tseeb, peb tsuas yog tsim lossis rub lub bash nrog cov kab tsim nyog ntawm cov cai thiab ua txhaum lub bash nrog chaw nres nkoj + cov lus uas peb xav tau tswj tuav.

Cov ntawv sau no uas tso cai rau peb los tsim cov web server yooj yim, ua haujlwm hauv ntau yam GNU / Linux distros thiab hauv OS X, nws tsis xav tau kev teeb tsa, nws yoog raws txoj hauv kev uas koj xav siv, nws tso cai rau txhua yam ntsiab lus, ntxiv rau nws tuaj yeem ncav cuag yog cov cuab yeej muaj txiaj ntsig zoo, nyob rau hauv rooj plaub koj xav muab cov ntaub ntawv nrawm rau ntawm txhua lub server.

Yuav ua li cas siv Shinatra

Ntxhoo Nws yog tsim los ntawm cov kab hauv qab no ntawm qhov chaws:

#! / bin / bash RESPONSE = "HTTP / 1.1 200 OK \ r \ nConnection: khaws-ciaj \ r \ n \ r \ n $ {2: -" OK "} \ r \ n" thaum {echo -en " $ RESPONSE "; } | nc -l "$ {1: -8080}"; ua ncha "============================================== = "ua tiav

Koj tuaj yeem yooj yim tsim ib .sh ntawv, nrog txhua lub npe koj xav tau thiab tom qab ntawd khiav nws raws li hauv qab no:

./shinatra.sh [port] [response]

Koj tseem tuaj yeem tau txais cov ntawv sau tshiab los ntawm cov chaw sau ntawv raug cai, ua qhov no, ua raws li cov theem no:

git clone https://github.com/benrady/shinatra.git cd shinatra / ./shinatra.sh 80 'Server Teb Xov Xwm'

Rau tsab ntawv koj tuaj yeem xa txhua yam koj xav tau, piv txwv li:

Tsim cov qhov web server yooj yim

Undoubtedly txoj kev nrawm, yooj yim thiab yooj yim los tso lub web server kom ua haujlwm, cov nqi hluav taws xob thiab cov haujlwm ntawm nws tau txawv. Koj siv tau cov ntawv no dab tsi? Koj puas pom nws muaj txiaj ntsig?


Cov ntsiab lus ntawm tsab xov xwm ua raws li peb cov ntsiab cai ntawm kev tswj hwm kev ncaj nceesCov. Tshaj tawm ib qho yuam kev nyem no.

7 lus, tawm koj li

Tso koj saib

Koj email chaw nyob yuav tsis tsum luam tawm. Yuav tsum tau teb cov cim nrog *

*

*

  1. Lub luag haujlwm rau cov ntaub ntawv: Miguel Ángel Gatón
  2. Lub hom phiaj ntawm cov ntaub ntawv: Tswj SPAM, kev tswj xyuas tawm tswv yim.
  3. Sau raws cai: Koj kev tso cai
  4. Kev sib txuas lus ntawm cov ntaub ntawv: Cov ntaub ntawv yuav tsis raug xa mus rau lwm tus neeg thib peb tsuas yog los ntawm kev txiav txim siab raug cai.
  5. Cov ntaub ntawv khaws cia: Cov Ntaub Ntawv khaws tseg los ntawm Occentus Networks (EU)
  6. Txoj Cai: Txhua lub sijhawm koj tuaj yeem txwv, rov qab thiab tshem tawm koj cov ntaub ntawv.

  1.   Gaspar Fernandez said

    Qee lub sijhawm dhau los kuv tau ua cov ntawv zoo sib xws uas koj tuaj yeem txhais ntau cov lus teb raws li txoj kev thiab txhua yam. Nws tsis yog 5 kab tab sis peb tuaj yeem ua tau ntau yam: http://totaki.com/poesiabinaria/2015/03/mini-servidor-web-con-bash-y-netcat-para-paginas-en-mantenimiento/

    Qhov kev poob ntawm kev ua nws netcat style yog tias peb tsis coj kom zoo dua qub, thiab cov khoom siv nyiaj txiag ntau lub sijhawm, tab sis nws yog qhov kev sim zoo.

  2.   Gonzalo martinez said

    Lwm txoj kev yog nrog sej (uas los txog hauv kev cuam tshuam tag nrho cov kev cuam tshuam)

    sudo sej -m SimpleHTTPServer 80

    Nws ua haujlwm txawv, txoj kev no ua haujlwm cov ntaub ntawv uas muaj nyob hauv cov ntawv uas tus neeg rau zaub mov khiav, tab sis nws yog lwm txoj kev yooj yim

  3.   Jose Perez said

    lwm qhov uas yog php
    php -S 127.0.0.1: 9000

  4.   Antonio Cifuentes qhov chaw duab said

    Cov ntawv no kuv nyeem ib xyoo dhau los, nyob rau hauv rooj plaub koj xav tau tag nrho cov web servers los ntawm cov kab hais kom ua.

    https://www.busindre.com/servidor_web_por_linea_de_comandos.

  5.   Eduardo Caum said

    Koj tuaj yeem hloov cov ntaub ntawv ntawm lub server uas tsis muaj ib yam dab tsi ntsia, thiab koj tsis muaj cai hauv paus:

    #! / rau hauv / bash
    ntawv = »$ 1 ″
    chaw nres nkoj = 8080

    n = »\ r \ n»
    lub cev = »$ (base64« $ {file} »)»

    RESPONSE = »HTTP / 1.1 200 OK»
    RESPONSE = »$ {RESPONSE} $ {n} Kev sib txuas: khaws-ciaj sia»
    RESPONSE = »$ {RESPONSE} $ {n} Cov Ntsiab Lus-hom: thov / octet-kwj»
    RESPONSE = »$ {RESPONSE} $ {n} Cov ntsiab lus-cais: inline; filename = \ »$ {ntawv} \» »
    RESPONSE = »$ {RESPONSE} $ {n} $ {n} $ {lub cev}»

    thaum {echo -en "$ RESPONSE"; } | nc -l "$ {port}"; ua
    ncha «==============================================
    ua li cas

    Tom qab ntawd, thaum koj tau txais nws, koj hloov nws dua nrog "base64 -d filename"

  6.   Eduardo Caum said

    Muaj ntau ntau yam piv txwv nyob rau hauv:
    $ tus txiv neej nc

  7.   Jose Maria Garcia said

    Ntawm Linux thiab macOS, xaiv lub plhaub thiab tus thawj tswj hwm pob tuaj yeem siv tau. Ntawm Windows 10, koj tuaj yeem teeb tsa Windows Subsystem rau Linux kom tau txais version ntawm Ubuntu thiab Bash ua ke nrog Windows, qhia tau zoo heev.

    https://clongeek.com/como-instalar-macos-desde-usb/