반응형

Raspberry Pi 에 Torr PHP 를 돌리기 위해서 웹서버 구축을 진행하였습니다. 많은 분들의 친절한 가이드 덕분에 쉽게 설치 및 활용할 수 있었습니다.

설치

다음과 같은 Script를 통nginx해 설치 하시면 됩니다.

#!/bin/bash
sudo apt update
sudo apt install nginx php-fpm php-curl

 

Nginx 설정

nginx 서버 설정을 위해서는 다음 위치에 있는 파일을 수정하시면 됩니다.

/etc/nginx/sites-enabled/default 파일을 통해 우리가 돌리고자 하는 웹서버 설정을 변경할 수있습니다.

저는 이곳에서 다음과 같은 설정을 변경하였습니다.

  1. Listen port: 접속 포트 수정
  1. root: web페이지 root dir 수정
  1. index 수정
  1. php: 수정
  1. ht: 수정
server {
				#수정
        listen 9000 default_server;
        listen [::]:9000 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;
        root /home/pi/www;
				
				#수정
        # 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;
        }

        # 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:9900;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
				#수정
        location ~ /\.ht {
                deny all;
        }
}

 

 

동작 테스트를 위해서 위에서 setting 한 루트폴더를 생성해 줍니다. 웹서버가 파일을 읽어갈 수있는 권한 세팅은 항상 필수 입니다. 기본계정인 www-data 계정이 해당 문서를 읽을 수 있도록 setting 해주시면됩니다.

sudo usermod -a -G www-data pi #Pi계정을 www-data그룹에 추가
mkdir -p /home/pi/www
sudo chown www-data:www-data -R /home/pi/www
sudo chmod -R 755 /home/pi/www

 

/home/pi/www/index.php 파일 생성

<?php phpinfo(); ?>

 

이후 nginx 서버를 restart 해주시면 phpinfo page(http://<ip>:9000)에 접근가능합니다.

sudo systemctl restart nginx

 

 

Torr php 사용

다음 스크립트를 활용하면 설치가 가능합니다. 클리앙에서 해당 스크립트와 환경을 공유해주신 롤케익, 반야지비 님 감사합니다

해당 스크립트의 상세한 사용법은 다음 페이지 참고 바랍니다.

다시 살아 돌아온 torr 입니다. : 클리앙
안녕하세요 예전에 토ㅇㅇ RSS 생성기를 만들어서 torr라는 이름으로 공유한 적이 있었습니다. 토ㅇㅇ 사이트들이 워낙에 자주 폐쇄되다 보니까 언제부턴가 업데이트에 손을 놔버려서 죽은 서비스가 되어버렸죠. 찾아보니까 2017년 6월이 마지막이었었네요. 3년만에 다시 살려보는 거네요 ㅎㅎ 이번에는 저도 쪼금 열심히 써보려고 자동 업데이트 기능을 강화했습니다. 지금 등록된 토ㅇㅇ 사이트가 폐쇄되면 다른 사이트를 찾아 업데이트를 해보려고요.
https://m.clien.net/service/board/cm_nas/15287609
#!/bin/bash
WWW_DIR=$HOME/www
mkdir -p $WWW_DIR/torr
chmod 755 -R $WWW_DIR/torr
pushd $WWW_DIR/torr
    sudo wget https://raw.githubusercontent.com/banyazavi/tsharp/master/defaults/torr.php
    sudo wget https://raw.githubusercontent.com/banyazavi/tsharp/master/defaults/UserConfig.php
popd

sudo chown -R www-data:www-data $WWW_DIR/torr
반응형

+ Recent posts