Exportar traduções
Ir para navegação
Ir para pesquisar
Configurações
Grupo
Atualizar o LibreRouterOS
Servidor Local Raspberry + Nginx + PhP7
Idioma
aa - Afar
ab - Abkhazian
abs - Ambonese Malay
ace - Achinese
ady - Adyghe
ady-cyrl - Adyghe (Cyrillic script)
aeb - Tunisian Arabic
aeb-arab - Tunisian Arabic (Arabic script)
aeb-latn - Tunisian Arabic (Latin script)
af - Afrikaans
ak - Akan
aln - Gheg Albanian
am - Amharic
an - Aragonese
ang - Old English
anp - Angika
ar - Arabic
arc - Aramaic
arn - Mapuche
arq - Algerian Arabic
ary - Moroccan Arabic
arz - Egyptian Arabic
as - Assamese
ase - American Sign Language
ast - Asturian
atj - Atikamekw
av - Avaric
avk - Kotava
awa - Awadhi
ay - Aymara
az - Azerbaijani
azb - South Azerbaijani
ba - Bashkir
ban - Balinese
bar - Bavarian
bbc - Batak Toba
bbc-latn - Batak Toba (Latin script)
bcc - Southern Balochi
bcl - Central Bikol
be - Belarusian
be-tarask - Belarusian (Taraškievica orthography)
bg - Bulgarian
bgn - Western Balochi
bh - Bhojpuri
bho - Bhojpuri
bi - Bislama
bjn - Banjar
bm - Bambara
bn - Bangla
bo - Tibetan
bpy - Bishnupriya
bqi - Bakhtiari
br - Breton
brh - Brahui
bs - Bosnian
btm - Batak Mandailing
bto - Iriga Bicolano
bug - Buginese
bxr - Russia Buriat
ca - Catalan
cbk-zam - Chavacano
cdo - Min Dong Chinese
ce - Chechen
ceb - Cebuano
ch - Chamorro
cho - Choctaw
chr - Cherokee
chy - Cheyenne
ckb - Central Kurdish
co - Corsican
cps - Capiznon
cr - Cree
crh - Crimean Turkish
crh-cyrl - Crimean Tatar (Cyrillic script)
crh-latn - Crimean Tatar (Latin script)
cs - Czech
csb - Kashubian
cu - Church Slavic
cv - Chuvash
cy - Welsh
da - Danish
de - German
de-at - Austrian German
de-ch - Swiss High German
de-formal - German (formal address)
din - Dinka
diq - Zazaki
dsb - Lower Sorbian
dtp - Central Dusun
dty - Doteli
dv - Divehi
dz - Dzongkha
ee - Ewe
egl - Emilian
el - Greek
eml - Emiliano-Romagnolo
en - English
en-ca - Canadian English
en-gb - British English
eo - Esperanto
es - Spanish
es-419 - Latin American Spanish
es-formal - español (formal)
et - Estonian
eu - Basque
ext - Extremaduran
fa - Persian
ff - Fulah
fi - Finnish
fit - Tornedalen Finnish
fj - Fijian
fo - Faroese
fr - French
frc - Cajun French
frp - Arpitan
frr - Northern Frisian
fur - Friulian
fy - Western Frisian
ga - Irish
gag - Gagauz
gan - Gan Chinese
gan-hans - Gan (Simplified)
gan-hant - Gan (Traditional)
gcr - Guianan Creole
gd - Scottish Gaelic
gl - Galician
glk - Gilaki
gn - Guarani
gom - Goan Konkani
gom-deva - Goan Konkani (Devanagari script)
gom-latn - Goan Konkani (Latin script)
gor - Gorontalo
got - Gothic
grc - Ancient Greek
gsw - Swiss German
gu - Gujarati
gv - Manx
ha - Hausa
hak - Hakka Chinese
haw - Hawaiian
he - Hebrew
hi - Hindi
hif - Fiji Hindi
hif-latn - Fiji Hindi (Latin script)
hil - Hiligaynon
ho - Hiri Motu
hr - Croatian
hrx - Hunsrik
hsb - Upper Sorbian
ht - Haitian Creole
hu - Hungarian
hu-formal - magyar (formal)
hy - Armenian
hyw - Western Armenian
hz - Herero
ia - Interlingua
id - Indonesian
ie - Interlingue
ig - Igbo
ii - Sichuan Yi
ik - Inupiaq
ike-cans - Eastern Canadian (Aboriginal syllabics)
ike-latn - Eastern Canadian (Latin script)
ilo - Iloko
inh - Ingush
io - Ido
is - Icelandic
it - Italian
iu - Inuktitut
ja - Japanese
jam - Jamaican Creole English
jbo - Lojban
jut - Jutish
jv - Javanese
ka - Georgian
kaa - Kara-Kalpak
kab - Kabyle
kbd - Kabardian
kbd-cyrl - Kabardian (Cyrillic script)
kbp - Kabiye
kg - Kongo
khw - Khowar
ki - Kikuyu
kiu - Kirmanjki
kj - Kuanyama
kjp - Eastern Pwo
kk - Kazakh
kk-arab - Kazakh (Arabic script)
kk-cn - Kazakh (China)
kk-cyrl - Kazakh (Cyrillic script)
kk-kz - Kazakh (Kazakhstan)
kk-latn - Kazakh (Latin script)
kk-tr - Kazakh (Turkey)
kl - Kalaallisut
km - Khmer
kn - Kannada
ko - Korean
ko-kp - Korean (North Korea)
koi - Komi-Permyak
kr - Kanuri
krc - Karachay-Balkar
kri - Krio
krj - Kinaray-a
krl - Karelian
ks - Kashmiri
ks-arab - Kashmiri (Arabic script)
ks-deva - Kashmiri (Devanagari script)
ksh - Colognian
ku - Kurdish
ku-arab - Kurdish (Arabic script)
ku-latn - Kurdish (Latin script)
kum - Kumyk
kv - Komi
kw - Cornish
ky - Kyrgyz
la - Latin
lad - Ladino
lb - Luxembourgish
lbe - Lak
lez - Lezghian
lfn - Lingua Franca Nova
lg - Ganda
li - Limburgish
lij - Ligurian
liv - Livonian
lki - Laki
lmo - Lombard
ln - Lingala
lo - Lao
loz - Lozi
lrc - Northern Luri
lt - Lithuanian
ltg - Latgalian
lus - Mizo
luz - Southern Luri
lv - Latvian
lzh - Literary Chinese
lzz - Laz
mai - Maithili
map-bms - Basa Banyumasan
mdf - Moksha
mg - Malagasy
mh - Marshallese
mhr - Eastern Mari
mi - Maori
min - Minangkabau
mk - Macedonian
ml - Malayalam
mn - Mongolian
mni - Manipuri
mnw - Mon
mo - Moldovan
mr - Marathi
mrj - Western Mari
ms - Malay
mt - Maltese
mus - Creek
mwl - Mirandese
my - Burmese
myv - Erzya
mzn - Mazanderani
na - Nauru
nah - Nāhuatl
nan - Min Nan Chinese
nap - Neapolitan
nb - Norwegian Bokmål
nds - Low German
nds-nl - Low Saxon
ne - Nepali
new - Newari
ng - Ndonga
niu - Niuean
nl - Dutch
nl-informal - Nederlands (informeel)
nn - Norwegian Nynorsk
no - Norwegian
nov - Novial
nqo - N’Ko
nrm - Norman
nso - Northern Sotho
nv - Navajo
ny - Nyanja
nys - Nyungar
oc - Occitan
olo - Livvi-Karelian
om - Oromo
or - Odia
os - Ossetic
pa - Punjabi
pag - Pangasinan
pam - Pampanga
pap - Papiamento
pcd - Picard
pdc - Pennsylvania German
pdt - Plautdietsch
pfl - Palatine German
pi - Pali
pih - Norfuk / Pitkern
pl - Polish
pms - Piedmontese
pnb - Western Punjabi
pnt - Pontic
prg - Prussian
ps - Pashto
pt - Portuguese
pt-br - Brazilian Portuguese
qqq - Message documentation
qu - Quechua
qug - Chimborazo Highland Quichua
rgn - Romagnol
rif - Riffian
rm - Romansh
rmy - Vlax Romani
rn - Rundi
ro - Romanian
roa-tara - Tarantino
ru - Russian
rue - Rusyn
rup - Aromanian
ruq - Megleno-Romanian
ruq-cyrl - Megleno-Romanian (Cyrillic script)
ruq-latn - Megleno-Romanian (Latin script)
rw - Kinyarwanda
sa - Sanskrit
sah - Sakha
sat - Santali
sc - Sardinian
scn - Sicilian
sco - Scots
sd - Sindhi
sdc - Sassarese Sardinian
sdh - Southern Kurdish
se - Northern Sami
sei - Seri
ses - Koyraboro Senni
sg - Sango
sgs - Samogitian
sh - Serbo-Croatian
shi - Tachelhit
shi-latn - Tachelhit (Latin script)
shi-tfng - Tachelhit (Tifinagh script)
shn - Shan
shy-latn - Shawiya (Latin script)
si - Sinhala
simple - Simple English
sk - Slovak
skr - Saraiki
skr-arab - Saraiki (Arabic script)
sl - Slovenian
sli - Lower Silesian
sm - Samoan
sma - Southern Sami
sn - Shona
so - Somali
sq - Albanian
sr - Serbian
sr-ec - Serbian (Cyrillic script)
sr-el - Serbian (Latin script)
srn - Sranan Tongo
ss - Swati
st - Southern Sotho
stq - Saterland Frisian
sty - cебертатар
su - Sundanese
sv - Swedish
sw - Swahili
szl - Silesian
ta - Tamil
tay - Tayal
tcy - Tulu
te - Telugu
tet - Tetum
tg - Tajik
tg-cyrl - Tajik (Cyrillic script)
tg-latn - Tajik (Latin script)
th - Thai
ti - Tigrinya
tk - Turkmen
tl - Tagalog
tly - Talysh
tn - Tswana
to - Tongan
tpi - Tok Pisin
tr - Turkish
tru - Turoyo
ts - Tsonga
tt - Tatar
tt-cyrl - Tatar (Cyrillic script)
tt-latn - Tatar (Latin script)
tum - Tumbuka
tw - Twi
ty - Tahitian
tyv - Tuvinian
tzm - Central Atlas Tamazight
udm - Udmurt
ug - Uyghur
ug-arab - Uyghur (Arabic script)
ug-latn - Uyghur (Latin script)
uk - Ukrainian
ur - Urdu
uz - Uzbek
uz-cyrl - Uzbek (Cyrillic script)
uz-latn - Uzbek (Latin script)
ve - Venda
vec - Venetian
vep - Veps
vi - Vietnamese
vls - West Flemish
vmf - Main-Franconian
vo - Volapük
vot - Votic
vro - Võro
wa - Walloon
war - Waray
wo - Wolof
wuu - Wu Chinese
xal - Kalmyk
xh - Xhosa
xmf - Mingrelian
xsy - Saisiyat
yi - Yiddish
yo - Yoruba
yue - Cantonese
za - Zhuang
zea - Zeelandic
zgh - Standard Moroccan Tamazight
zh - Chinese
zh-cn - Chinese (China)
zh-hans - Simplified Chinese
zh-hant - Traditional Chinese
zh-hk - Chinese (Hong Kong)
zh-mo - Chinese (Macau)
zh-my - Chinese (Malaysia)
zh-sg - Chinese (Singapore)
zh-tw - Chinese (Taiwan)
zu - Zulu
Formato
Exportar para tradução off-line
Exportar no formato nativo
Obter
{{DISPLAYTITLE:Servidor Local Raspberry + Nginx + PhP7}}<languages/> Tutorial Servidor Local com Raspberry Pi Necessidades * RaspberryPi 3 * Fonte de 3A * Cabo ethernet * hd externo de 1Tb * cartão de memória Instruções - Para ligar uma raspberypi é necessário que ela tenha um cartão sd com um sistema operacional próprio. Para isso a opção mais simples e leve é o sistema operacional Raspbian Stretch Lite, e você pode baixar em: <pre> https://www.raspberrypi.org/downloads/raspbian/ </pre> - Você vai baixar um arquivo compactado no formato zip, em sistemas linux você pode usar o terminal e descompactar com o comando: <pre> unzip 2019-07-10-raspbian-buster-lite.zip </pre> - Sistemas operacionais precisam ser escritos no cartão sd, isso é diferente de simplesmente copiar e colar. Para isso, em um terminal (Lembre sempre de conferir as permissões), podemos escrever o sistema com o seguinte comando: <pre> dd bs=4M if=22019-07-10-raspbian-buster-lite.img of=/dev/sdX conv=fsync </pre> sdX é a partição onde está o seu cartão de memoria, se precisar de um <code>df -h</code> para saber qual é a partição seu cartão de memória. - De uma maneira mais simples você pode usar o [https://www.balena.io/etcher/ | Etcher], e nem precisa descompactar - Uma vez o sistema escrito no cartão sd, para não ter que ligar em um monitor para configurar o sistema, vamos permitir que ele aceite o acesso por ssg. Para isso insira o cartão sd no computador e crie um arquivo vazio na partição boot, chamado ssh, com o comando <pre> sudo touch /media/USUARIO/boot/ssh </pre> - Conecte na Raspberry, por um cabo de rede no seu roteador e acesse ela com o seguinte comando: <pre> ssh pi@raspberrypi </pre> E use a senha padrão: raspberry ** Se por algum motivo isso não funcionar e a raspi der como saida "conection refuse ... port 22", você vai precisar acessar a raspberry por em alguma tela, utilizar um teclado e fazer <pre> rm /etc/ssh/ssh_host_* dpkg-reconfigure openssh-server </pre> - Conecte o USB e use o comando abaixo para ver onde ele foi conectado (por ex /dev/sda1) <pre> df -h </pre> - Crie a pasta onde o pendrive/HD será montado: <pre> sudo mkdir hdexterno sudo mount /dev/sda1 /media/hdexterno </pre> - crie as pastas para os conteudos <pre> sudo mkdir /media/hdexterno/musicas sudo mkdir /media/hdexterno/fotos sudo mkdir /media/hdexterno/textos sudo mkdir /media/hdexterno/fotos </pre> - Atualize os repos <pre> sudo apt update && sudo apt upgrade </pre> - Agora vamos instalar os pacotes que precisamos: <pre> sudo apt-get install -y nginx </pre> - Inicie o nginx <pre> sudo /etc/init.d/nginx start </pre> - Teste no seu navegador digitando <pre> raspberrypi.lan </pre> - Instale os pacotes do php7.0 e git <pre> sudo apt-get install php-fpm git </pre> - edite o arquivo de configuração do nginx para conectar o nginx com o php <pre> sudo nano /etc/nginx/sites-available/default </pre> encontre a linha <pre> index index.html index.htm; </pre> Insira nessa linha a entrada <code>index.php</code> depois de index <pre> index index.php index.html index.htm; </pre> Mais abaixo encontre a seguinte secção <pre> # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # # location ~ \.php$ { </pre> remove a <code>#</code> para que o fique dessa maneira: <pre> # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { include snippets/fastcgi-php.conf; # With php-fpm (or other unix sockets): fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # With php-cgi (or other tcp sockets): # fastcgi_pass 127.0.0.1:9000; } </pre> No bloco que diz <code> location ~ \ </code> escreva as seguintes linhas: <pre> location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; autoindex on; autoindex_exact_size off; } </pre> Ao final o arquivo deve ficar da seguinte maneira: <pre> ## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. # https://www.nginx.com/resources/wiki/start/ # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ # https://wiki.debian.org/Nginx/DirectoryStructure # # In most cases, administrators will remove this file from sites-enabled/ and # leave it as reference inside of sites-available where it will continue to be # updated by the nginx packaging team. # # This file will automatically load configuration files provided by other # applications, such as Drupal or Wordpress. These applications will be made # available underneath a path with that package name, such as /drupal8. # # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## # 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/html; # Add index.php to the list if you are using PHP index index.php 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; autoindex on; autoindex_exact_size off; } # pass PHP scripts to FastCGI server # location ~ \.php$ { include snippets/fastcgi-php.conf; # # # With php-fpm (or other unix sockets): fastcgi_pass unix:/run/php/php7.3-fpm.sock; # # With php-cgi (or other tcp sockets): # fastcgi_pass 127.0.0.1:9000; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # Virtual Host configuration for example.com # # You can move that to a different file under sites-available/ and symlink that # to sites-enabled/ to enable it. # #server { # listen 80; # listen [::]:80; # # server_name example.com; # # root /var/www/example.com; # index index.html; # # location / { # try_files $uri $uri/ =404; # } #} </pre> Recarregue o arquivo de configuração com o comando: <pre> sudo /etc/init.d/nginx reload </pre> - Crie um arquivo teste.php na pasta /var/www/html/ com o seguinte conteúdo <pre> <?php phpinfo(); ?> </pre> - no seu navegador digite <pre> raspberry.lan/teste.php </pre> - Se uma página com várias informações apareceu, então está tudo certo. Caso contrário, algum erro ocorreu. - Clone o conteúdo do git na sua pasta inicial <pre> cd ~ git clone https://github.com/coolabnet/template_aldeia.git </pre> - Edite com as informações da sua comunidade e copie todo o conteúdo para sua pasta web, e colocar o usuario www-data como dono de tudo que tem na pasta web para que possamos enviar e baixar arquivos <pre> sudo cp -r ~/template_aldeia/* /var/www/html/ sudo chown -R www-data /var/www/html/* </pre> - confira o hostname rodando <pre> hostname -I </pre> - mude o hostname da raspiberry <pre> vim /etc/hostname </pre> o endereço do seu servidor local vai ser hostname.lan. - Para utilizar o hd externo para guardar o conteudo do servidor local crie links simbolicos dentro da pasta /var/www/html <pre> cd /var/www/html ln -s musicas /media/hdexterno/musicas/ ln -s videos /media/hdexterno/videos/ ln -s textos /media/hdexterno/textos/ ln -s fotos /media/hdexterno/fotos/ </pre> Acesso seu servidor local e seja feliz! Ref. [https://www.raspberrypi.org/documentation/remote-access/web-server/nginx.md]
Menu de navegação
Ferramentas pessoais
português do Brasil
Entrar
Espaços nominais
Página especial
Variantes
Visualizações
Mais
Pesquisa
Navegação
Página principal
Mudanças recentes
Página aleatória
Ajuda do MediaWiki
Ferramentas
Páginas especiais
Versão para impressão