본문 바로가기

ETC

[CentOS] CentOS7 웹서버 (http, https)

web server 설치

>> yum install httpd

>> service httpd start

>> yum install php

>> yum install php-mysql



web server http 포트변경 (80 -> 8080)

>> vi /etc/httpd/conf/httpd.conf 수정

- Listen 8080

>> vi /etc/httpd/conf/httpd.conf 마지막에 추가

------------------------------------------------------

# Virtual hosts

Include conf/extra/httpd-vhosts.conf

------------------------------------------------------

>> mkdir /etc/httpd/conf/extra

>> vi /etc/httpd/conf/extra/httpd-vhosts.conf 생성 후 수정

------------------------------------------------------

<VirtualHost *:8080>

  DocumentRoot "/var/www/html"

  <Directory /var/www/html>

    Options FollowSymLinks MultiViews

    AllowOverride All

    Order allow,deny

    allow from all

    require all granted

  </Directory>

</VirtualHost>

------------------------------------------------------



web server https 설정 및 포트변경 (443 -> 8443)

>> yum install mod_ssl openssl

>> mkdir /etc/httpd/ssl; cd /etc/httpd/ssl

>> openssl genrsa -out server.key 2048

>> openssl req -new -key server.key -out server.csr

>> openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

>> vi /etc/httpd/conf/httpd.conf 추가

- Listen 8443

>> vi /etc/httpd/conf/extra/httpd-vhosts.conf 추가

------------------------------------------------------

<VirtualHost *:8443>

  DocumentRoot "/var/www/html"

  SSLEngine on

  SSLCertificateFile /etc/httpd/ssl/server.crt

  SSLCertificateKeyFile /etc/httpd/ssl/server.key

  <Directory /var/www/html>

    Options FollowSymLinks MultiViews

    AllowOverride All

    Order allow,deny

    allow from all

    require all granted

  </Directory>

</VirtualHost>

------------------------------------------------------

 

 

 

출처 : http://rosnot.tistory.com/98