[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howtos:network_services:setup_apache [2015/03/29 09:33 (UTC)] – [ENABLE PHP] arfon | howtos:network_services:setup_apache [2020/11/07 17:06 (UTC)] (current) – 14.2 and beyond need proxy_module loaded to get httpd started with cgi support peter | ||
---|---|---|---|
Line 3: | Line 3: | ||
This is a general how to to get a basic httpd service up and running. | This is a general how to to get a basic httpd service up and running. | ||
- | Applies to: \\ | + | Applies to: |
- | | + | |
- | | + | |
- | ====== | + | ====== |
- | 1) Edit / | + | |
+ | Edit / | ||
< | < | ||
- | ServerAdmin you@myawesomeserver.com | + | |
+ | | ||
ServerName www.myawesomeserver.com: | ServerName www.myawesomeserver.com: | ||
| | ||
Line 35: | Line 37: | ||
CustomLog "/ | CustomLog "/ | ||
| | ||
- | | + | |
- | Include / | + | Include / |
+ | # Optional | ||
+ | Include / | ||
</ | </ | ||
All other default settings should be good. | All other default settings should be good. | ||
- | HINT: With these settings, your default webpages should be put in / | + | Make httpd start on boot. |
- | 2) Make it start on boot. | ||
< | < | ||
/ | / | ||
+ | **HINT:** With these settings, your default webpages should be put in / | ||
- | ====== USER DIRECTORIES ====== | ||
- | This will allow users to have individual web space (/ | ||
- | EXAMPLE: \\ | ||
- | | ||
+ | ====== User Directories ====== | ||
- | 1) Edit / | + | This will allow users to have individual web space (/ |
+ | |||
+ | Example: < | ||
+ | |||
+ | |||
+ | Edit / | ||
< | < | ||
Line 63: | Line 69: | ||
Include / | Include / | ||
- | 2) Edit / | + | Edit / |
< | < | ||
Line 72: | Line 78: | ||
</ | </ | ||
- | 3) Restart Apache | + | Restart Apache |
< | < | ||
- | ====== CGI-BIN ====== | + | ====== |
This enables CGI script execution on your webserver. | This enables CGI script execution on your webserver. | ||
- | + | Edit / | |
- | 1) Edit / | + | |
< | < | ||
+ | |||
+ | LoadModule proxy_module | ||
LoadModule proxy_fcgi_module lib64/ | LoadModule proxy_fcgi_module lib64/ | ||
LoadModule proxy_scgi_module lib64/ | LoadModule proxy_scgi_module lib64/ | ||
- | LoadModule cgid_module lib64/ | + | LoadModule cgid_module |
< | < | ||
Line 100: | Line 108: | ||
</ | </ | ||
- | 2) Restart Apache | + | Restart Apache |
< | < | ||
- | HINT: Your cgi-bin directory will be / | + | **HINT:** Your cgi-bin directory will be / |
- | EXAMPLE: \\ | + | Example: < |
- | http:// | + | |
| | ||
- | **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. |
| | ||
- | ====== | + | ====== |
- | 1) Setup CGI-BIN as described above. | + | |
- | 2) Edit /etc/httpd/extra/httpd-userdir.conf and add the following: | + | 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: < |
+ | |||
+ | Setup CGI-BIN as described above. | ||
+ | |||
+ | Edit / | ||
+ | < | ||
+ | |||
+ | < | ||
Options ExecCGI | Options ExecCGI | ||
SetHandler cgi-script | SetHandler cgi-script | ||
</ | </ | ||
- | 3) Restart Apache | + | Restart Apache |
< | < | ||
+ | ====== Enable PHP ====== | ||
- | HINT: This will allow users to run CGI scripts out of their /home/USER/ | + | [[howtos: |
- | EXAMPLE: | + | ====== Virtual Hosts ====== |
- | | + | |
+ | Edit / | ||
- | ====== | + | < |
- | [[howtos:network_services: | + | |
+ | Include / | ||
+ | |||
+ | Edit / | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | ServerAdmin webmaster@www.server1.com | ||
+ | DocumentRoot "/ | ||
+ | ServerName server1.com | ||
+ | ServerAlias www.server1.com | ||
+ | ErrorLog "/ | ||
+ | CustomLog "/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ServerAdmin webmaster@www.server2.com | ||
+ | DocumentRoot "/ | ||
+ | ServerName server2.com | ||
+ | ServerAlias www.server2.com | ||
+ | ErrorLog "/ | ||
+ | CustomLog "/ | ||
+ | </ | ||
+ | |||
+ | Restart Apache | ||
+ | < | ||
+ | |||
+ | **NOTE:** I run my vhosts as users so, the document roots are under /home/user directories. You do not have to do this. You can put the document roots anywhere you like. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | / | ||
+ | / | ||
+ | |||
+ | **NOTE 2:** These do not affect your default webserver setting in / | ||
+ | |||
+ | |||
+ | ====== | ||
+ | |||
+ | If you have virtual hosts that need CGI (or need CGI in their own directory) you can do it like this: | ||
+ | |||
+ | Edit / | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | Options ExecCGI | ||
+ | SetHandler cgi-script | ||
+ | </ | ||
+ | |||
+ | Restart Apache | ||
+ | < | ||
+ | |||
+ | **HINT:** I usually put these with their respective < | ||
- | ====== VIRTUAL HOSTS ====== | + | **NOTE:** Change the "/ |
- | to be added | + | |