336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

How To Install nginx, MySQL, PHP (LEMP) stack on Ubuntu 14.04


nginx -v 1.4.6

php -v 5.5.9


sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nginx
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//' 
sudo apt-get install mysql-server
sudo mysql_install_db
sudo mysql_secure_installation
sudo apt-get install php5-fpm php5-mysql php5-cli
sudo vim /etc/php5/fpm/php.ini

cgi.fix_pathinfo=0

sudo service php5-fpm restart
sudo vim /etc/nginx/sites-available/default

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;

    server_name localhost;

    location / {
        try_files $uri $uri/ =404;
    }
}

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.php index.html index.htm;

    server_name server_domain_name_or_IP;

    location / {
        try_files $uri $uri/ =404;
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

sudo service nginx restart
vim info.php
phpinfo();

http://server_domain_name_or_IP/info.php

sudo rm /usr/share/nginx/html/info.php


많이 사용하는 php 모듈도 미리 설치해놓자.

apt-get install php5-geoip, php5-curl

service php5-fpm restart


참고 #https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-14-04


'Web Service' 카테고리의 다른 글

OWASP Honeypot  (0) 2022.03.10
[PHP] IP체크 정규식  (0) 2016.07.12
Nginx SSH 설정 & Rewrite 설정  (0) 2016.07.12

+ Recent posts