print( sjw.iq == 200) output : true

[PHP] Ubuntu18.04에 php, apache, laravel 설치 및 설정 본문

PHP

[PHP] Ubuntu18.04에 php, apache, laravel 설치 및 설정

sjwiq200 2019. 8. 1. 17:09
728x90
반응형

우선 apt 업데이트를 진행해줍니다~!

 

※ Apt (Advanced Package Tool 의 약어) 는 Debian 시스템에 포함된 핵심 도구들의 집합체이다.

apt update
apt upgrade

 

apache2 설치

apt install apache2

 

php 설치

apt-get install php7.1

 

php 모듈 설치

apt-get install php-mbstring
apt-get install php-curl
apt-get install php-mysql
apt-get install php-xml
apt-get install php-xmlrpc
apt-get install php-gd
apt-get install php-imagick

sudo apt-get install php-dev libmcrypt-dev gcc make autoconf libc-dev pkg-config
sudo pecl install mcrypt-1.0.1
echo "extension=mcrypt.so" | sudo tee -a /etc/php/7.2/apache2/conf.d/mcrypt.ini

apt-get install php-tidy


apt-get install libapache2-mod-php7.2

apt-get install composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
PATH=$PATH:/usr/local/bin/

 

시간 설정

#dpkg-reconfigure tzdata

 

apache2  설정 (/etc/apache2/sites-available/000-default.conf)

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        #DocumentRoot /var/www/html
        DocumentRoot /var/www/zzim-api-php/public
        <Directory /var/www/zzim-api-php/public>
                AllowOverride All
        </Directory>

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

 

보안 설정

# deny file, folder start with dot
<DirectoryMatch "^\.|\/\.">
    Require all denied
</DirectoryMatch>
  
# deny (log file, binary, certificate, shell script, sql dump file) access.
<FilesMatch "\.(?i:log|binary|pem|enc|crt|conf|cnf|sql|sh|key|yml|lock|gitignore)$">
    Require all denied
</FilesMatch>
  
# deny access.
<FilesMatch "(?i:composer\.json|contributing\.md|license\.txt|readme\.rst|readme\.md|readme\.txt|copyright|artisan|gulpfile\.js|package\.json|phpunit\.xml|access_log|error_log|gruntfile\.js|bower\.json|changelog\.md|console|legalnotice|license|security\.md|privacy\.md)$">
    Require all denied
</FilesMatch>
 
# Allow Lets Encrypt Domain Validation Program
<DirectoryMatch "\.well-known/acme-challenge/">
    Require all granted
</DirectoryMatch>

 

git clone 후 .env 파일을 작성해줍니다.

 

그리고 아파치를 재시작 해줍니다.

 

#만약 file 관련 에러가 나면 다음 명령어로 storage폴더에 쓰기 권한을 줍시다.

chmod -R gu+w storage
chmod -R guo+w storage

 

별거 없죠?!?!

 

이게 끝입니다~!

728x90
반응형
Comments