일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- 웹서버구축
- Injection 숫자형
- SQL having group by
- php-fpm
- Injection 공격 기초
- JavaScript
- SQL Injection basic
- portswigger academy
- web 보안
- Linux
- DOM 객체
- 웹 해킹 기초
- sql injection table name
- 웹 기초
- sql 인젝션 기초
- 공부하는 블로그
- JS
- HTTP request smuggling
- SQL INJECTION DB NAME
- Injection 취약점
- SQL 인젝션
- sql injection
- BOM 객체
- http 취약점
- 웹 보안
- SQL 주석
- web 취약점
- nginx
- sql injection 데이터 추출
- Union injection
- Today
- Total
IMLENA
[LEMP stack] WEB서버 구축(nginx, php-fpm, centos7) 본문
지난번 centos 6 에 이어 Centos7로 LEMP 스택 구성하기
1. yum repo에 nginx 설치용 추가
- 없이 하면 conf 파일 등 수정할게 많고 잔오류가 생김
vi /etc/yum.repos.d/nginx.repo
파일 생성
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1
위 내용 입력 후 저장
#yum install nginx
#nginx -V
버전 확인
#firewall-cmd --permanent --zone=public --add-port={80,443}/tcp
#firewall-cmd --reload
방화벽에 포트 추가
#systemctl start nginx
2. php 설치
#yum install epel-release
#yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
#yum install yum-utils
#yum-config-manager --enable remi-php72
remi 레포지터리 php72 적용
#yum update
#yum -y install php72*
#yum install php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache -y
#php72 --version
PHP 7.2.34 (cli)
#systemctl start php72-php-fpm
3. php - nginx 설정
#vi /etc/opt/remi/php72/php-fpm.d/www.conf
24 user = nginx
26 group = nginx
apache 는 nginx로 변경한다.
#vi /etc/nginx/conf.d/default.conf
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
해당 부분 uncomment
#vi /usr/share/nginx/html/info.php
<?php
phpinfo();
?>
파일 만들어서 test
4. mariadb
#yum -y install mariadb-server
#vi /etc/my.cnf.d/client.cnf
[client]
default-character-set=utf8
#vi /etc/my.cnf.d/server.cnf
[mysql]
character-set-server = utf8
collaiton-server = utf8_general_ci
#vi /etc/my.cnf.d/mysql-clients.cnf
[mysql]
default-character-set=utf8
[mysqldump]
default-character-set=utf8
#mysql
>use mysql;
>update user set password=password('패스워드') where user='root';
>flush privileges;
DB root 계정 비밀번호까지 설정 완료
기타 설정
systemctl enable mariadb
systemctl enable php72-php-fpm
systemctl enable nginx
firewall-cmd --permanent --zone=public --add-port={80,443}/tcp
firewall-cmd --reload
--error
failed to start nginx.service: Unit is masked.
> systemctl unmask nginx
/lib/systemd/system/nginx.service, pid 관련 에러
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
을 위 file에 넣어 줌
#reboot
*2021-03-23 DB PHP 연동 문제, PHP 권한, DB function error* 원인 찾아야함
open(/var/opt/remi/php72/lib/php/session/sess_kc7c6if4424su3l7k73q1o4rc7, O_RDWR) failed: Permission denied (13)
- permission error
/var/opt/remi/php72/lib/php/session의 apache 소유 부분을 nginx로 변경한다.
chown -R nginx:nginx /var/opt/remi/php72/lib/php/session
-sql 구문에러
PHP Fatal error: Uncaught Error: Call to undefined function mysql_select_db()
mysql 을 mysqli로 변경
-php72 버젼에서는 mysql_connection등의 구문이 error남
-취약점 진단 목적 서버이므로 php 5.6 버전으로 새로 설치 하기로 했다
위 다운 받은 php yum remove -
#yum-config-manager --enable remi-php56
#yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo
#yum-config-manager --disable remi-php56
#yum install php56 php56-php-fpm
-php56 버전도 같은 에러 발생
mysql -> mysqli 등 소스 파일 직접수정하는게 나을 듯 하다.
mysqli_connection($conn,DB네임) < 순
$_SESSION['user']; < 인자들 ' ' 필수
수정하니 홈페이지 기능들이 정상 작동한다...
소소한 error는 천천히 고치자
'기타' 카테고리의 다른 글
칼리리눅스 설치 2021 ( Kali 2021 linux install, VM ) (0) | 2021.04.09 |
---|---|
네트워크 망/ 서버 구축 실습 1 - Switch L2,L3 (0) | 2021.04.09 |
[서버구축] Tomcat 9 CentOS 7 - 과정 (0) | 2021.03.25 |
[WEB hacking] WebGoat 8 & JAVA 설치 with Centos7 (0) | 2021.03.22 |
[서버]웹서버 구축(Nginx+PHP+Mysql) (0) | 2021.03.20 |