-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapache
executable file
·31 lines (28 loc) · 992 Bytes
/
apache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# Script to run Apache HTTP Server out of any folder on any port
# Example:
# apache start 8080
# apache stop 8080
localPath=`pwd`
if [ "${1}" == "start" ]; then
sudo httpd \
-f "${HOME}/OneDrive/System/Configurations/httpd.conf" \
-C "Listen ${2}" \
-C "ServerName localhost:${2}" \
-C "DocumentRoot \"${localPath}\"" \
-C "PidFile \"${localPath}/httpd.pid\"" \
-C "ErrorLog \"${localPath}/error_log\"" \
-C "IncludeOptional \"${localPath}/httpd.con[f]\""
echo "Started Apache HTTP Server at localhost:${2}"
elif [ "${1}" == "stop" ]; then
sudo httpd \
-f "${HOME}/OneDrive/System/Configurations/httpd.conf" \
-C "Listen ${2}" \
-C "ServerName localhost:${2}" \
-C "DocumentRoot \"${localPath}\"" \
-C "PidFile \"${localPath}/httpd.pid\"" \
-C "ErrorLog \"${localPath}/error_log\"" \
-C "IncludeOptional \"${localPath}/httpd.con[f]\"" \
-k stop
echo "Stopped Apache HTTP Server at localhost:${2}"
fi