I want to configure Apache2 and tomcat7 with mod_jk in Linux environment ..I want to know the steps ..Please help me to congure it...
Have you tried anything yourself?
http://tomcat.apache.org/connectors-doc/generic_howto/quick.html should get you going. But if you have not tried anything yet how can we help you then? Let use know if anything specific goes wrong, including error messages etc.
You have to configuration for the apache (i use CentOS). The first file is under /etc/httpd/conf/wokers.properties
# the name tomcat1 is variable
worker.list=tomcat1
# default ajp port on server.xml of tomcat
worker.tomcat1.port=8009
worker.tomcat1.host=localhost
worker.tomcat1.type=ajp13
worker.tocmat1.socket_timeout=200
worker.tomcat1.retries=1
The second file depends on whether global or want Customizing for a virtual host. The following example is based on a virtual host (/etc/httpd/conf/virtualhost.conf)
JkWorkersFile "/etc/httpd/conf/workers.properties
JkLogFile /var/log/httpd/jk.log
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkLogLevel info
# mount all under URI /
JkMount /* tomcat1
# umount /robots.txt, request goes to apache document root
JkMount /robots.txt tomcat1
Related
please help me with the following problem:
I have a fresh installed Ubuntu Desktop 20.4 here and installed Apache2 from the ubuntu-repository.
For a test I disabled the 000-default.conf from the sites-enabled directory with a2dissite and removed the file 000-default.conf from the sites-available directory. "apachectl configtest" shows that the syntax is ok. "apachectl -S" shows, that there is no virtual host configuration. I have restarted the computer, but the Apache webserver still serves the standard Website. There are fresh entries in the "other_vhost_access.log". I wonder what configuration serves this website. I thought, when there is no conf-file enabled in "sites-enabled" apache doesn't serve any website?!
Where did I go wrong? Didn't find anything while searching. It's difficult to find the keywords.
Thanx for any help in advance.
Regards
Endi
Apache is serving as per config settings in the main configuration files apache2.conf or httpd.conf
I've followed several sets of instructions, including an online recorded lecture, that show just copying the dvwa folder to /opt/lampp/htdocs and visiting localhost/dvwa in the browser with Xampp services started. I've attempted this, but this is the screen I get (instead of the DVWA page prompting me to log in and set up the database).
What could the problem be? Has anyone run into this before? I've reattempted the instructions on this virtual computer and on my windows 10 host over the past few days and cannot get past this, even the slightest bit of advice would be incredibly appreciated.
Allow the usage of custom virtual hosts
By default, xampp in ubuntu won't use the httpd-vhosts.conf file (the location of the virtual hosts), therefore we need to indicate that this file will be included during the runtime of apache. Open with your favorite code editor the httpd.conf file located tipically in /opt/lampp/etc or just execute the following command in your terminal to open a simple editor:
sudo gedit /opt/lampp/etc/httpd.conf
Now locate yourself in (about) the line 487 where you probably will find the following lines:
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
As you can see, the Include statement that includes the httpd-vhosts.conf file is commented. Proceed to modify the line uncommenting that line:
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
And you're ready to configure your custom vhost.
Create a custom domain in the hosts file of your system
You need to create a custom domain where our apache virtual host will point to. This domain will be normally an ip (127.0.0.xx based) and a custom name.
To start, edit the hosts file located in /etc using your favorite code editor, or just by executing the following command in the terminal:
sudo gedit /etc/hosts
And proceed to add your custom host. In this example, our ip will be 127.0.0.3 and the domain myawesomeproject. So finally, our hosts file will look like:
Save the file, and now the domain myawesomeproject is an alias for the local address 127.0.0.5.
Create your first virtual host
Tipically, you need to create the virtual host in the httpd-vhosts.conf file located in /opt/lampp/etc/extra. Use your favorite editor to edit that file or just execute the following command to edit it in a terminal:
sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
And create your own virtual host in this file. As shown in our custom domain in the vhost file of the system, the port that we are going to use is 127.0.0.5, therefore our virtual host will be:
<VirtualHost 127.0.0.5:80>
DocumentRoot "/opt/lampp/htdocs/my-first-project"
DirectoryIndex index.php
Options All
AllowOverride All
Require all granted
The deep and custom configuration of your VirtualHost is up to you. Save the file, and you're ready to test it.
Test your virtual host
To test it, in the folder /opt/lampp/htdocs/my-first-project, create a simple PHP file
(index.php) that will contain the following PHP code:
Start apache, mysql (entire XAMPP) using the following command (or whatever the way you start apache and the other required services):
sudo /opt/lampp/lampp start
Navigate in your favorite browser to http://myawesomeproject/ or http://127.0.0.5/ and you should get as output "Hello World" in the browser.
I'm trying to install GitLab, but I want to install it on an Apache web server on my VPS.
I know that GitLab was built for nginx, but I honestly don't want to use it. I was wondering how I would be able to have a setup so that
mysite.com would retrieve the files (like index.html, folders with more files in them, etc.) in /var/www/html
lab.mysite.com would retrieve GitLab.
I've heard you're supposed to use a virtual host, but remember, I'm still an amateur at best with this kind of stuff, so if anyone here is kind enough to make a short step-by-step guide to do this, I'd appreciate this.
Note: Before I've been using this guide to install GitLab, however this is for Nginx, so I was wondering if I was to use this guide but then add onto it, or if I'm going about this all wrong.
By default GitLab will install nginx but usually won't add nginx to your system's service manager (service or systemctl). This makes it confusing when trying to enable Apache (Apache won't start due to default port 80 in use by nginx).
Assuming you've installed Gitlab according to the default install instructions, the Nginx service will now be managed by the gitlab-ctl service manager (which is installed when installed Gitlab).
To stop Nginx, run the following from a command line as root:
gitlab-ctl stop nginx
Now that port 80 is free, you can start Apache (don't forget to install Apache if it's not already / Instructions are for RHEL systems - modify accordingly for Ubuntu etc). Assumes you are root user:
yum install -y httpd;
systemctl start httpd;
systemctl enable httpd;
Let's edit the Gitlab config file to disable nginx and tell gitlab to use apache:
vi /etc/gitlab/gitlab.rb
Add either your domain or IP to the following:
external_url 'http://git.yourdomain.com/'
Find:
# web_server['external_users'] = []
Change to (don't forget to remove the leading '#'):
web_server['external_users'] = ['apache']
Find:
# nginx['enable'] = true
Change to:
nginx['enable'] = false
And finally we have to run a "recompile" with:
gitlab-ctl reconfigure
gitlab-ctl restart
Now the Apache config. When we installed Gitlab, it added a user group called gitlab-www. We need to allow the apache user access to that group. The following assumes you've installed apache and the user apache (48) exists:
To check which group gitlab installed itself under, you can run:
getent group
Now lets modify apache's user and add it to the gitlab-www group:
usermod apache --append --groups gitlab-www
Now we need an Apache Virtual Host to point to the gitlab install.
Add a virtual host to Apache's conf.d directory (this will create a new file):
vi /etc/httpd/conf.d/gitlab.conf
Add the following (tweak according to your needs):
<VirtualHost *:80>
ServerName git.yourdomain.com
ServerSignature Off
ProxyPreserveHost On
<Location />
Order deny,allow
Allow from all
ProxyPassReverse http://127.0.0.1:8080
ProxyPassReverse http://git.yourdomain.com/
</Location>
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]
# needed for downloading attachments
DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log combined env=!dontlog
</VirtualHost>
... And now restart Apache:
systemctl start httpd
You may run into issues with things like selinux - You can set things to permissive for debugging purposes.
setenforce 0
I hope this helps someone!
I've tried almost everything.
When I go to a docker container by ssh and curl localhost:8080 there, I get normal welcome page, but If I do curl host_machine_hostname:8082 from my hostmachine by ssh or from everything else using hostname of my hostmachine, I get error, access forbidden.
I have read alot of suggestions but nothing helped.
Connector settings without address does not help, Valve rules with allow=".*" does not help, Host address=host_machine_hostname" does not help.
UPD
I'm sorry. I realized about the root of the problem. I'm using a custom fork of the tomcat and there were specific options for ROOT and other preinstalled packages to block everything while the 127.0.0.1 and the localhost are allowed. So I've got this thing working by removing package-specific context.xml files.
This is because the context.xml in webapps/{package}/META-INF/ was modified to block everytyhing, and if to Read TFM, package's context.xml has more power above the global context.xml file, that's why I couldn't change anything by modifying the global context.xml.
I realized about the root of the problem. I'm using a custom fork of the tomcat and there were specific options for ROOT and other preinstalled packages to block everything while the 127.0.0.1 and the localhost are allowed. So I've got this thing working by removing package-specific context.xml files.
This is because the context.xml in webapps/{package}/META-INF/ was modified to block everytyhing, and if to Read TFM, package's context.xml has more power above the global context.xml file, that's why I couldn't change anything by modifying the global context.xml.
I have set up ubuntu server on an old pc with webmin as well. I am not sure what was going on but i restarted the server and when it boots it now get this when Apache tries to start.
* Starting web server apache2
apache2: Syntax error on line 237 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/000-default: No such file or directory
Action 'start' failed.
The Apache error log may have more information.
I have checked this file on this line and it looks like this:
# Include the virtual host configurations:
Include sites-enabled/
I have removed Apache and re installed it but not sure why it still fails.
As also answered by Qben, the issue was an invalid symlink in the sites-enabled folder. Removing the broken symlink and adding a valid one will fix the issue.
You do not have a default site enabled:
/etc/apache2/sites-enabled/000-default: No such file or directory
site-enabled should contain symlinks to files in site-available and I guess your 000-default symlink does not link to a real file in site-available.
I guess this Ubuntu guide might be of interest for you.
One of the reason may be that you might have some site that is not enabled.To check that
Go to /etc/apache2/sites-enabled
Out of many/some [sitename].conf files , one/some may be crossed
Delete those found crossed
Restart apache server
sudo service apache2 restart.
Hope this has helped you , but may be some other reason too. Thank you.