Configuring and Running Apache on Solaris

The Apache web server comes with the Solaris 10 operating system but needs some configuration before it can be used. These steps can assist you in getting Apache up and running….

Step 1

Log in as the root user, or another user with root privileges.

Step 2: Check the current status of Apache

svcs -a | grep -i http
This will most likely show the status as disabled

disabled       15:28:56 svc:/network/http:apache2

Step 3: Create the httpd.conf file

cp /etc/apache2/httpd.conf-example /etc/apache2/httpd.conf

Step 4: Edit httpd.conf

cd /etc/apache2
vi httpd.conf
Locate “### Section 2: ‘Main server configuration”
Ensure that the following are correctly set:

  • User nobody
  • Group nobody
  • ServerAdmin <email for Apache administrator>
  • DocumentRoot <where the documents will be served from>, i.e. “/usr/apache/htdocs”
  • <Directory …> same as Document root i.e. <Directory “/usr/apache/htdocs”>

Step 5: Save the file

<esc> :wq

Step 6: Enable Apache

svcadm enable svc:/network/http:apache2

Step 7: Check that Apache is online

svcs -a | grep -i http

online         15:40:31 svc:/network/http:apache2

Step 8: Test that Apache is serving the content correctly

Through a web browser, visit http://<name of your server>.
The test page for Apache should be displayed.

Step 9: Upload your content

You can now upload the content you wish to display.
I tend to upload this to a folder under another account via FTP and then copy the files to the /usr/apache/htdocs directory. This is because my root account is not allowed to connect via FTP as a security measure.

If you need to restart Apache:

svcadm restart apache2

If you need to disable Apache:

svcadm disable svc:/network/http:apache2

Troubleshooting

If the status of Apache is shown as maintenance then check that the httpd.conf file is located correctly in /etc/apache2

maintenance       15:28:56 svc:/network/http:apache2

Please feel free to leave a comment if you find this useful or need some further help.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *