how do i use apache2 server for hosting a website? - apache2

I am using ubuntu and I have some html pages. I want to host a website from my PC at my home. How can I do this using apache2? I am new to Apache2 if any one knows how to do this, please let me know.

The easiest way to publish HTML files with apache is by putting them in /home/your-user-name-please-do-replace-me/public_html, making sure that your apache is installed and then start apache. How to make apache start after a reboot, see this forum post on Ubuntu Forums.
When you have apache up and running, find out your servers IP-address (http://whatismyipaddress.com/ is pretty handy for this) and then your files will be accessible from: http://you-ip-address-whatever/~your-user-name-please-do-replace-me
You could always use services like http://www.dyndns.com/ so that you don't have to use your IP-address all the time.

Once apache is installed you should find that you can place content in a directory silimar to /usr/www or /usr/share/www and apache will serve it. You may also need to start apache, I don't know the ubuntu command but on fedora 12 it is:
service httpd start

Related

Project inside webapp tomcat8 does not run in webpage

I am trying to run my application using tomcat8 inside the Apache2 virtual machine, using MacOS.
The IP address is: http://143.167.11.2:8080
and this the view when I run the link on the browser:
I have installed tomcat8 inside this apache2 VM using: apt-get install tomcat8 by following this instruction: https://www.linode.com/docs/development/frameworks/apache-tomcat-on-ubuntu-16-04/
When I run this address http://143.167.11.2:8080 the result is the same, it just shows this same picture . It does not show the tomcat home page.
I have tried to run this: ./startup.sh and inside the terminal and it started.
But when I run the linked address http://143.167.11.2:8080 the result is same, it shows apache home page.
I tried to put my project inside /var/lib/tomcat8/webapps and then tried to run: http://143.167.11.2:8080/visualisation-dataproject.
But the result like below:
Any idea how can I run my project (that I put on the webapps folder) on the web browser?
Apache2 is usually use for PHP project. Tomcat is usually for java project. There are some possibility why you can not run tomcat on the web browser. One of the reason is you have not install tomcat8 properly. Even you have install it, you should check it really work or not. If it work on the VM, maybe the problem when you set the port for tomcat in server.xml.
To check server.xml, try : sudo nano /etc/tomcat8/server.xml, and find <Connector port="8080" protocol="HTTP/1.1 ... line.
And try to change the port 8080 to another port e.g: 8081. Why? to prevent tomcat8 server running with same port with another server such as apache2.
After that try the step on this link: https://askubuntu.com/a/434085/856656 it should work.

Apache 2.4.6 and Apache Tomcat 7.0.42 on Port 80

On my Ubuntu 13.10 I have installed Apache and Tomcat. I am trying to get tomcat to work on port 80 with no luck at all. I have looked at using mod_jk following several online tutorials with no success. What I am trying to achieve is I have a webapp on tomcat running as the root application. Therefore the current url is www.example.com:8080. I also have apache which is on the url www.example.com. I want to be able to access files on the apache webserver for e.g www.example.com/somefile but also have my webapp running at the sametime on www.example.com. Please can anyone help.
You need to add url redirection to apache and check for the path in apache httpd.conf.
Check the path of the incoming request is just example.com then you rewrite it to example.com:8080.
The mod_proxy of apache should be able to do this for you.
http://tomcat.apache.org/tomcat-4.1-doc/proxy-howto.html
Apache Tomcat by default runs on port 8080. Incase if you need to run it in port 80 you need to use JSVC which comes along with tomcat. If you have installed tomcat by downloading the binary version then jsvc will be available under
[tomcat_install_path]/bin/commons-daemon-native.tar.gz
you need to untar it and compile it. Compiling it is easy.
# ./configure
# make
once you have compiled it you will get the jsvc binary file which needs to be placed under the tomcat bin directory.
Then to start up tomcat with the help of jsvc follow the steps mentioned here
JSVC is the officially recommended way of starting Tomcat in port 80.
So I managed to solve this problem by Using Mod_Proxy. Editing the 000-Deafult.conf file in /etc/apache2/sites-enabled and adding the following lines:
ProxyPass /SomeUrl !
ProxyPass / http://localhost:8080/
The first line indicates what you don't want to proxy and the second one indicates what to proxy.In this case forward the ROOT app of Tomcat at port 8080 to the root of the Apache web server
Also edited the server.xml file in /etc/tomcat7 and added the following
<Connector port="8080" protocol="AJP/1.3" proxyName="www.mydomain.com" proxyPort="80"/>

Nagios plugins - copy and execute?

I have a Nagios server installation up and running.
I'm starting to deploy check_mk out to all my client machines.
I am using mrpe for custom checks on my client machines.
As one of the checks, I would like to use the check_ssh plugin.
I tried to copy check_ssh from another machine to the client but it looks like it won't allow me to run it this way. Can I get away from actually installing the nagios agent and just stick to check_mk and be able to run Nagios plugins?
The exact error I am getting is:
ld.so.1: check_ssh: fatal: libintl.so.3: open failed: No such file or directory
thanks in advance
Most of the plugins in the standard nagios-plugins pack are compiled C, so if you're copying them to a different distribution or architecture they may not work. I would consider just downloading the nagios-plugins package or grabbing the latest source package for the client machines.
Nagios Plugins Source tarball
http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz
You can check SSH without nrpe plugin, it can be done from the Nagios server, just use the check_ssh plugin with this command (launched from the server):
./usr/local/nagios/libexec/check_ssh -H <client_ip>
If it's enabled it should print something like:
SSH OK - OpenSSH_6.0p1 Debian-4+deb7u1 (protocol 2.0) |
time=0,018154s;;;0,000000;10,000000
(That's because i'm using Debian Wheezy)
check_ssh comes with Nagios plugins tarball...
I'm currently using
nagios-plugins-2.0.2.tar.gz
Good luck...

Ushahidi No Input File Specified

I have been trying to install Ushahidi platform for weeks but without any luck. I recently started over using Ushahidi latest release ushahidi-Ushahidi_Web-2.0.1-140-g0991172.zip and extracted it to folder ushahidi under my root.
I am using godaddy Linux server. I have tried both the manual and wizard to setup Ushahidi. In all cases, after installation, I get the same error when I try to access admin page. The error reads:
No input file specified.
I have tried tried installing using the wizard and the manual process. My PHP version is as required.
Any help will be appreciated. I need it to work so I can move on and customize it. Very disappointing such a good open source tool has poor installation guides!
Thanks.
Sting
there are a few things that can trip up following the installation.
Make sure that:
mod_rewrite is turned on in apache "a2enmod rewrite"
AllowOverride All is set in your apache config for your site (/etc/apache2/sites-available/default)
your .htaccess file points to the correct webroot

How do I add PHP support to Apache 2 without breaking my current installation?

I run Apache 2 with WSGI (for a Django-app) on a Ubuntu box. I want to use Nagios for server monitoring, and for this purpose it seems I have to add PHP support to Apache.
When I installed Apache 2, I did this:
apt-get install apache2 apache2.2-common apache2-mpm-worker apache2-threaded-dev libapache2-mod-wsgi python-dev
Available modules for apache2 are these:
/etc/apache2/mods-available$ ls
actions.conf authn_default.load cache.load deflate.conf filter.load
mime.conf proxy_ftp.load suexec.load actions.load authn_file.load
cern_meta.load deflate.load headers.load mime.load proxy_http.load
unique_id.load alias.conf authnz_ldap.load cgi.load dir.conf
ident.load mime_magic.conf rewrite.load userdir.conf alias.load
authz_dbm.load cgid.conf dir.load imagemap.load mime_magic.load
setenvif.conf userdir.load asis.load authz_default.load cgid.load
disk_cache.conf include.load negotiation.conf setenvif.load usertrack.load
auth_basic.load authz_groupfile.load charset_lite.load disk_cache.load info.conf
negotiation.load speling.load version.load auth_digest.load authz_host.load
dav.load dump_io.load info.load proxy.conf ssl.conf
vhost_alias.load authn_alias.load authz_owner.load dav_fs.conf env.load
ldap.load proxy.load ssl.load wsgi.conf authn_anon.load
authz_user.load dav_fs.load expires.load log_forensic.load proxy_ajp.load
status.conf wsgi.load authn_dbd.load autoindex.conf dav_lock.load
ext_filter.load mem_cache.conf proxy_balancer.load status.load authn_dbm.load
autoindex.load dbd.load file_cache.load mem_cache.load proxy_connect.load
substitute.load
What is the best way for me to add PHP support to Apache 2 without breaking my current installation and configuration?
IS the issue your referring to the Python WSGi.
if so take a look here to see if this helps you, Im not fully update with Python so not sure but hope it can help.
--
This module allows you to run PHP processes inside of Python, using a WSGI gateway. This way PHP applications can appear like normal Python WSGI applications, and WSGI middleware routing and filters can all be applied in front of them. For instance, WSGI middleware-based authentication or authorization, routing, deployment, or styling filters (like WSGIOverlay).
http://pythonpaste.org/wphp/

Resources