이전 글 이어서 진행하도록 하겠습니다.
nginx 설정으로 갑니다.
vi /etc/nginx/sites-availble/default
fastcgi를 활성화 해줍시다.
ifconfig -a 명령어로 ip를 확인하고 다음 명령어로 web.conf를 만들어줍시다.
$ ifconfig -a ## inet 확인 후
$ vi /etc/nginx/conf.d/web.conf
다음과 같이 web.conf를 작성해줍시다.
server {
listen 443 ssl http2 default_server;
server_name 192.;
index server.php;
root /var/www/laravel;
ssl on;
ssl_certificate /etc/nginx/ssl/cacert.pem;
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
location @rewrite {
rewrite ^/(.*)$ /server.php?_url=/$1;
}
location / {
try_files $uri $uri/ /server.php?$query_string;
}
location ~ \.php$ {
fastcgi_split_path_info %(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index server.php;
fastcgi_param SCRIPT_FILLENAME /avr/www/web/$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgI_script_name;
include fastcgi_params;
}
}
ssl 파일을 만들어줍시다.
$ cd /etc/nginx/ssl/
$ sudo openssl genrsa -out privkey.pem 2048
$ sudo openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095
$ sudo openssl dhparam 2048 > /etc/nginx/ssl/dhparam.pem
다음 글에서 계속 됩니다.
'Web > Server' 카테고리의 다른 글
[서버구축] ssh root 로그인 수정하기 (0) | 2020.12.31 |
---|---|
[서버 구축] Ubuntu + Nginx + MariaDB + Laravel 설치하기 - 마지막 (0) | 2020.12.29 |
[서버 구축] Ubuntu + Nginx + MariaDB + Laravel 설치하기 - (3) (0) | 2020.12.12 |
[서버 구축] Ubuntu + Nginx + MariaDB + Laravel 설치하기 - (2) (0) | 2020.12.08 |
[서버 구축] Ubuntu + Nginx + MariaDB + Laravel 설치하기 - (1) (0) | 2020.12.08 |
최근댓글