새소식

반응형
OS/Linux

[Linux] 리눅스 아파치(httpd) 설치하기

  • -
반응형

2023-01-26


사진: Unsplash 의 Phil Desforges


1. 방법

 

아래의 명령어 순서대로 입력하면 아파치 설치 및 확인을 할 수 있다. 

 

## 아파치 설치
yum install -y httpd

## 아파치 재부팅시 자동시작 등록
systemctl enable httpd

## 아파치 재기동
service httpd restart

## 아파치 상태확인
service httpd status

## 아파치 잘 올라오는지 확인
http://아이피또는도메인정보/

## 설정파일 확인
vi /etc/httpd/conf/httpd.conf

yum이 제대로 동작하지 않는다면 업데이트 후 재실행을 하면 된다.

 

# yum update

테스트 페이지 정상적으로 웹에 노출되며, 설치는 완료된 것이다.

 


2. 홈경로 변경

 

vi /etc/httpd/conf/httpd.conf 명령어를 통해 아래 /변경할 경로라고 써져 있는 곳에 자신이 원하는 경로를 입력하면 된다.

 

. . .
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/변경할경로"

#
# Relax access to content within /var/www.
#
<Directory "/변경할경로">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

# Further relax access to the default document root:
<Directory "/변경할경로">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    . . .

메인 이미지 출처 : 사진: Unsplash의 Phil Desforges  

 

반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.