-
Laravel) Nginx + Laravel(라라벨) 설정Programing Language/PHP 2021. 8. 3. 13:34728x90반응형
nginx의 default 파일 설정
위치 : /etc/nginx/sites-available/default
------------------------------------------------------------------------------------------
server{
listen 80 default_server;
listen [::]:80 default_server;
root /(projectFolder)/public; #laravel public 폴더 절대경로 설정
# Add index.php to the list if you are using PHP
index index.html index.htm index.php;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
server_name _;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; #버전에 맞게 설정
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
------------------------------------------------------------------------------------------------
참고자료
728x90반응형'Programing Language > PHP' 카테고리의 다른 글
PHP) 클래스와 지시자 (->) 문법 (0) 2021.08.03 Laravel) Json Request를 Controller에서 다루기 (0) 2021.08.03 Laravel) HTTP post 메소드 419 Page Expired 해결방법 (0) 2021.08.03 Laravel) Log파일 접근 권한 설정 (0) 2021.08.03 PHP) PHP로 FCM보내기 (0) 2020.11.11