Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
howtos:network_services:setup_apache [2018/12/23 21:40 (UTC)] – [Setup Apache httpd server] Formatting ellendhel | howtos:network_services:setup_apache [2018/12/23 21:48 (UTC)] – [ENABLE PHP] Formatting ellendhel |
---|
* Apache 2 (and possibly previous versions) | * Apache 2 (and possibly previous versions) |
| |
====== BASIC SETUP ====== | ====== Basic Setup ====== |
1) Edit /etc/httpd/httpd.conf - Here is what you care about, change/uncomment the following lines as necessary: | |
| Edit /etc/httpd/httpd.conf - Here is what you care about, change/uncomment the following lines as necessary: |
<code>vi /etc/httpd/httpd.conf | <code>vi /etc/httpd/httpd.conf |
| |
ServerAdmin you@myawesomeserver.com <---OPTIONAL | # optional, require a proper DNS configuration |
| ServerAdmin you@myawesomeserver.com |
ServerName www.myawesomeserver.com:80 | ServerName www.myawesomeserver.com:80 |
| |
CustomLog "/var/log/httpd/access_log" common | CustomLog "/var/log/httpd/access_log" common |
| |
Include /etc/httpd/extra/httpd-autoindex.conf <---OPTIONAL but nice. this creates a directory listing if index.html is missing. | # Optional but nice. this creates a directory listing if index.html is missing. |
Include /etc/httpd/extra/httpd-default.conf <---OPTIONAL | Include /etc/httpd/extra/httpd-autoindex.conf |
| # Optional |
| Include /etc/httpd/extra/httpd-default.conf |
</code> | </code> |
| |
All other default settings should be good. | All other default settings should be good. |
| |
2) Make httpd start on boot. | Make httpd start on boot. |
<code>chmod 755 /etc/rc.d/rc.httpd | <code>chmod 755 /etc/rc.d/rc.httpd |
/etc/rc.d/rc.httpd start</code> | /etc/rc.d/rc.httpd start</code> |
| |
| |
====== USER DIRECTORIES ====== | ====== User Directories ====== |
This will allow users to have individual web space (/home/USER/public_html). These can be accessed from the web by adding "~USERNAME" to the URL. \\ | |
EXAMPLE: \\ | This will allow users to have individual web space (/home/user/public_html). These can be accessed from the web by adding "~username" to the URL. |
http://www.slackware.com/~pat | |
| Example: <nowiki>http://www.slackware.com/~pat</nowiki> |
| |
| |
1) Edit /etc/httpd/httpd.conf - Here is what you care about, change/uncomment the following lines as necessary: | Edit /etc/httpd/httpd.conf - Here is what you care about, change/uncomment the following lines as necessary: |
<code> vi /etc/httpd/httpd.conf | <code> vi /etc/httpd/httpd.conf |
| |
Include /etc/httpd/extra/httpd-userdir.conf</code> | Include /etc/httpd/extra/httpd-userdir.conf</code> |
| |
2) Edit /etc/httpd/extra/httpd-userdir.conf, change/uncomment the following: | Edit /etc/httpd/extra/httpd-userdir.conf, change/uncomment the following: |
<code>vi /etc/httpd/extra/httpd-userdir.conf | <code>vi /etc/httpd/extra/httpd-userdir.conf |
| |
</Directory></code> | </Directory></code> |
| |
3) Restart Apache | Restart Apache |
<code>/etc/rc.d/rc.httpd restart</code> | <code>/etc/rc.d/rc.httpd restart</code> |
| |
| |
====== ENABLE CGI-BIN ====== | ====== Enable CGI-BIN ====== |
This enables CGI script execution on your webserver. | |
| |
| This enables CGI script execution on your webserver. |
| |
1) Edit /etc/httpd/httpd.conf - Here is what you care about, change/uncomment the following lines as necessary: | Edit /etc/httpd/httpd.conf - Here is what you care about, change/uncomment the following lines as necessary: |
<code> vi /etc/httpd/httpd.conf | <code> vi /etc/httpd/httpd.conf |
| |
</IfModule></code> | </IfModule></code> |
| |
2) Restart Apache | Restart Apache |
<code>/etc/rc.d/rc.httpd restart</code> | <code>/etc/rc.d/rc.httpd restart</code> |
| |
**HINT:** Your cgi-bin directory will be /srv/httpd/cgi-bin/. The scripts can be accessed by adding /cgi-bin/SCRIPTNAME to the website URL. | **HINT:** Your cgi-bin directory will be /srv/httpd/cgi-bin/. The scripts can be accessed by adding /cgi-bin/SCRIPTNAME to the website URL. |
| |
EXAMPLE: \\ | Example: <nowiki>http://www.slackware.com/cgi-bin/awesomescript.pl</nowiki> |
http://www.slackware.com/cgi-bin/awesomescript.pl | |
| |
**NOTE: This does not apply to php scripts, see the below for them.** | **NOTE**: This does not apply to PHP scripts, see the below for them. |
| |
| |
| |
====== USER CGI-BIN ====== | ====== User CGI-BIN ====== |
This will allow users to run CGI scripts out of their /home/USER/public_html/cgi-bin directory. Their scripts can be accessed through their user directories. | |
| |
EXAMPLE: | This will allow users to run CGI scripts out of their /home/user/public_html/cgi-bin directory. Their scripts can be accessed through their user directories. |
http://www.slackware.com/~pat/cgi-bin/webform.pl | |
| |
1) Setup CGI-BIN as described above. | Example: <nowiki>http://www.slackware.com/~pat/cgi-bin/webform.pl</nowiki> |
| |
2) Edit /etc/httpd/extra/httpd-userdir.conf - Here is what you care about, change/uncomment the following lines as necessary: | Setup CGI-BIN as described above. |
| |
| Edit /etc/httpd/extra/httpd-userdir.conf - Here is what you care about, change/uncomment the following lines as necessary: |
<code>vi /etc/httpd/extra/httpd-userdir.conf | <code>vi /etc/httpd/extra/httpd-userdir.conf |
| |
</Directory></code> | </Directory></code> |
| |
3) Restart Apache | Restart Apache |
<code>/etc/rc.d/rc.httpd restart</code> | <code>/etc/rc.d/rc.httpd restart</code> |
====== ENABLE PHP ====== | ====== Enable PHP ====== |
[[howtos:network_services:setup_apache_php_mysql|http://docs.slackware.com/howtos:network_services:setup_apache_php_mysql]] | [[howtos:network_services:setup_apache_php_mysql|http://docs.slackware.com/howtos:network_services:setup_apache_php_mysql]] |
| |