Apache Server Adminstrator


 ------------------------Apache Notes

connect To apache 

ssh -p2222 user@localhost


get Server Detials 

cat /etc/*-release 


get apache status 

apachectl status


shutdown Apache

sudo apachectl -k stop


Start Apache

sudo apachectl -k start


Stop Apache Using Linux Script 

sudo /etc/init.d/apache2 stop


Start Apache Using Linux Script 

sudo /etc/init.d/apache2 start


Start apache server gracefully 

sudo service apache2 graceful


Configuring Apache

fedora , centos -> /etc/httpd/conf/httpd.conf,


Debian And Ubuntu -> /etc/apache2/apache2.conf,


Using apachectl

apachectl -v


Search The Entire File System 

sudo find / | grep "httpd\.conf" or sudo find / | grep "apache2\.conf"


see the server management file 

less /etc/apache2/apache2.conf  (space For Down Q to exit)


configataion of a specific site

/etc/apache2/sites-available/alice.conf


check configataion

apachectl -t


get a list of all virtual host

apachectl -t -D DUMP_VHOSTS


get a list of all Modules

apachectl -t -D DUMP_MODULES


Apache Module 


you can wrap module configataion in if module

<ifModule mod_ssl>


disables Apache Module

.conf holds the configataion for the module

.load acctually loads the module


/mods available

/mods accessable


apache logs 





 

 grep -Ri ErrorLog /etc/apache2

 {the main error log is /etc/apache2/apache2.conf:ErrorLog${APACHE_LOG_DIR}/error.log}

 

  grep -Ri "export APACHE_LOG_DIR"/etc/apache2

  

  /var/log/apache2 (here you can find the log files)

  

  

  edit log files 

  sudoedit /etc/apache2/sites-available/alice.conf (adding logging files)

  

  after 

  DocumentRoot/srv/web

  

  ErrorLog ${APACHE_LOG_DIR}/filename-error.log

  

  logLevel info 

  CustomLog ${APACHE_LOG_DIR}/filename-access.log combined

  

  

  

  watch log in real time 

  tail -f logfilename.log 

  

  

 Tools For Analysing log files

 AWStats,GoAccess,graylog,logstach

























No comments:

Post a Comment