Getting started with apache2

official page

apache2 official page

how to install

$ sudo apt update
$ sudo apt install apache2

how to start

$ sudo service apache2 start

comand line option

Usage: apache2 [-D name] [-d directory] [-f file]
            [-C "directive"] [-c "directive"]
            [-k start|restart|graceful|graceful-stop|stop]
            [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
-D name            : define a name for use in <IfDefine name> directives
-d directory       : specify an alternate initial ServerRoot
-f file            : specify an alternate ServerConfigFile
-C "directive"     : process directive before reading config files
-c "directive"     : process directive after reading config files
-e level           : show startup errors of level (see LogLevel)
-E file            : log startup errors to file
-v                 : show version number
-V                 : show compile settings
-h                 : list available command line options (this page)
-l                 : list compiled in modules
-L                 : list available configuration directives
-t -D DUMP_VHOSTS  : show parsed vhost settings
-t -D DUMP_RUN_CFG : show parsed run settings
-S                 : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES : show all loaded modules 
-M                 : a synonym for -t -D DUMP_MODULES
-t                 : run syntax check for config files
-T                 : start without DocumentRoot(s) check
-X                 : debug mode (only one worker, do not detach)

Quote) https://httpd.apache.org/

check for config files

# run syntax check for config files
$ apache2 -t

/var/www/html

Make sure apache2 is running.

$ curl localhost && echo success || echo failed

The html that Apache sends to the browser is / var / www / html /.

This is called ** Document Root **.

By placing the file here, it will be possible to refer to it via Apache.

Go to document root

$ cd /var/www/html
$ touch test.html
$ echo "Hello World!" > ./test.html

Start your browser and enter the following. [IP address] /test.html

Change document root

/etc/apahce2/apache2.conf

To change.

<Directory /var/www/> 
</Directory>

Change the part that is as follows.

<Directory /home/ubuntu/www>    
</Directory>

Then restart apache2.

$ sudo service apache2 restart 

Recommended Posts

Getting started with apache2
Getting started with Android!
1.1 Getting Started with Python
Getting Started with Golang 2
Getting Started with Golang 1
Getting Started with Python
Getting Started with Django 1
Getting Started with Optimization
Getting Started with Golang 3
Getting Started with Numpy
Getting started with Spark
Getting Started with Python
Getting Started with Pydantic
Getting Started with Golang 4
Getting Started with Jython
Getting Started with Django 2
Translate Getting Started With TensorFlow
Getting Started with Python Functions
Getting Started with Tkinter 2: Buttons
Getting Started with Go Assembly
Getting Started with PKI with Golang ―― 4
Getting Started with Python Django (1)
Django Getting Started: 3_Apache integration
Getting Started with Python Django (4)
Getting Started with Python Django (3)
Getting Started with Python Django (6)
Getting Started with Django with PyCharm
Python3 | Getting Started with numpy
Getting Started with Python Django (5)
Materials to read when getting started with Apache Beam
Getting Started with Python responder v2
Getting Started with Git (1) History Storage
Getting started with Sphinx. Generate docstring with Sphinx
Getting Started with Python Web Applications
Getting started on Docker Apache Hadoop
Getting Started with Sparse Matrix with scipy.sparse
Getting Started with Julia for Pythonista
Getting Started with Python Basics of Python
Getting Started with Cisco Spark REST-API
Getting started with USD on Windows
Getting Started with Python Genetic Algorithms
Getting started with Python 3.8 on Windows
Getting Started with Python for PHPer-Functions
Getting Started with CPU Steal Time
Grails getting started
Getting Started with python3 # 1 Learn Basic Knowledge
Getting Started with Python Web Scraping Practice
Getting Started with Python for PHPer-Super Basics
Getting Started with Python Web Scraping Practice
Getting started with Dynamo from Python boto
Getting Started with Lisp for Pythonista: Supplement
Getting Started with Heroku, Deploying Flask App
Getting Started with TDD with Cyber-dojo at MobPro
Getting started with Python with 100 knocks on language processing
Django 1.11 started with Python3.6
MongoDB Basics: Getting Started with CRUD in JAVA
Getting Started with Drawing with matplotlib: Writing Simple Functions
Getting started with Keras Sequential model Japanese translation
[Translation] Getting Started with Rust for Python Programmers
Django Getting Started Part 2 with eclipse Plugin (PyDev)
Get started with MicroPython