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
/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