Apache2 Ubuntu config showing google search - linux

I have configured my fresh installed apache. When I am trying to put local.myproject in the browser it starts searching on google. Like the link was not working. Could somebody please tell me what happens? I tried to restart apache and reload the conf files.
sites-availabe/myproject.conf:
ServerName local.myproject
DirectoryIndex index.php index.html
DocumentRoot /home/programmer/NetBeansProjects/myproject/public
ErrorLog ${APACHE_LOG_DIR}/error_1.log
CustomLog ${APACHE_LOG_DIR}/access_1.log combined
<Directory /home/programmer/NetBeansProjects/myproject/public>
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
/etc/hosts file:
127.0.0.1 localhost
127.0.1.1 computer
127.0.0.1 local.myproject

Restart your Apache server by:
sudo service apache2 restart
OR
Check error log:
ls /var/log/apache2/error-YOURDOMAINNAME.log
You can check what you missed by check every steps here.

Related

Installing MantisBT on WSL2

I have installed MantisBT in Ubuntu in wsl2, I had no problem following the instructions like in another ubuntu server (unless for enabling ufw), but at the moment of open the browser to proceed with the installation I just see the contents of the file index.php.
index.php in Browser
I'd try to search information about installing mantisBT in wsl without success, so that is why I come here to ask if anyone had successfully installed MantisBT in Ubuntu in Wsl or you have any clues to try to resolve this.
This is my apache confid file,
<VirtualHost *:80>
ServerAdmin webmaster#yourdomain.com
DocumentRoot "/var/www/html/mantis"
ServerName localhost
ServerAlias localhost
ErrorLog "/var/log/apache2/mantis-error_log"
CustomLog "/var/log/apache2/mantis-access_log" combined
<Directory "/var/www/html/mantis/">
DirectoryIndex index.php index.html
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
It was due to a missing php package, so first make sure you have all the packages require, I found this thanks to the mantis-error_log file, In my case was php-fpm. but just installing it does not do the trick, yo have to install it, start the service and restart apache2
sudo apt install php7.x-fpm
sudo service php7.x-fpm start
sudo service apache2 restart
One thing I may have forgot also, was to change the permissions of the mantis folder
sudo chmod -R 755 /var/www/html/mantis
and finally I made some changes in th conf file and system32/drivers/host
to make it work at its own URL. This was just improvemnt, not really part of th problem.
<VirtualHost *:80>
ServerAdmin webmaster#yourdomain.com
DocumentRoot "/var/www/html/mantis"
ServerName mantis.test
ServerAlias www.mantis.test
ErrorLog "/var/log/apache2/mantis-error_log"
CustomLog "/var/log/apache2/mantis-access_log" combined
<Directory "/var/www/html/mantis/">
DirectoryIndex index.php index.html
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
system32/drivers/etc/hosts
127.0.0.1 mantis.test
::1 mantis.test

Apache 2 default document root won't change (Ubuntu)

I want to prevent direct access to the server web root showing the Ubuntu home page at /var/www/html/index.html
I have changed the following:
/etc/apache2/sites-available/000-default.conf
DocumentRoot /var/www/websites
And restarted Apache but it's still going to /var/www/html if I visit my server directly.
Edit:
It appears this problem is only when I access the server on HTTPS. On HTTP it works fine.
You also need to change in /etc/apache2/apache2.conf. Find this:
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
and change to your desired directory

Reverse proxy from NodeJS to Apache using node-http-proxy does not work

While experimenting with node.js on my vps I stumbled across a problem I can not seem to get fixed.
I have an apache server running alongside node.js on ubuntu 13.04. My idea was to create a reverse proxy using node-http-proxy. Enough information about this can be found, but I seem to have an error that I can not find.
First I changed the apache ports:
NameVirtualHost *:9000
Listen 9000
Then I have my hello.js file:
var http = require('http');
var httpProxy = require('http-proxy');
var options = {
router: {
'somesite.com': '127:0:0:1:9000'
}
}
var proxyServer = httpProxy.createServer(options).listen(80);
console.log("Proxy server running!");
and finally the apache somesite.com config:
<VirtualHost *:9000>
ServerName somesite.com
ServerAdmin info#somesite.com
ServerAlias www.somesite.com
DocumentRoot /var/www/somesite.com/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I have a basic html file in public_html to make sure everything is working.
When I start both servers and go to somesite.com then I just see a blank wepbage (if I inspect source there is nothing, instead of my own file).
If I start a simple node server on another port and route traffic to that port, that works, so I'm assuming my problem is apache related, but I can't figure out what is wrong.
Edit 1:
Apparently my proxy only worked for somesite.com and not www.somesite.com. If I go to somesite.com I get:
An error has occurred: {"code":"EINVAL","errno":"EINVAL","syscall":"connect"}
Edit 2:
If I check the access and error log from apache it seems it never receives anything. No messages of me to be found
Edit 3:
I changed the port on which nodejs is listening, thinking that maybe the running as root has something to do with it, but even running on a random high port, it is not working. It can't seem to make a connection between itself and the apache socket (which works perfectly when I directly browse to it).
Apparently replacing 127.0.0.1 with localhost in the hello.js script did the trick. Not completely sure why (I guess it has something to do with my hosts file), but it works.

Error setting up multiple vhosts with Apache2 on Mint 15

I just installed Apache2 on mint 15. I am able to see the localhost and so decided to add virtual hosts for my projects.
I have added the hostnames at /etc/hosts
127.0.0.1 eclipse
I also added vhost details at /etc/apache2/site-avaliable:
<VirtualHost *:80>
ServerAdmin webmaster#eclipse
ServerName eclipse
ServerAlias www.eclipse
# Indexes+Document Root
DirectoryIndex index.html index.php
DocumentRoot /home/cygnus/Dropbox/Workspace_Eclipse
#logfiles
ErrorLog /var/log/apache2/eclipse-error.log
CustomLog /var/log/apache2/eclipse-access.log combined
<Directory /home/cygnus/Dropbox/Workspace_Eclipse>
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
</VirtualHost>
I activated the vhost using:
sudo a2ensite example.com
Also added following to /etc/apache2/httpd.conf
ServerName localhost
ServerName eclipse
After all the work I checked:
http://localhost - works OK.
http://eclipse - gives 403 error.
Do I need to do anything more to add vhost in linux? Did I miss or mess up some step?
Any help is appreciated - Thanks in advance :)
Update:
I tried changing the DocumentRoot to "/var/www/test/" - this works
but I need it to work at home level.
I used chown and chgrp to set owner and group to both www-data and root - neither worked.
It's probably the <Directory> container:
<Directory /home/cygnus/Dropbox/Workspace_Eclipse>
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
Are you sure your requests are actually coming from 127.0.0.1? What's the remote_addr IP that shows up in the logs? To verify, try removing the Deny from all line and see if you can access it.
Found my answer here
All I was missing was: chmod -R 755 /home/cygnus/Dropbox/*

Resolving virtual hosts apache 2

I'm trying to setup my apache server to access certain folders when I type addresses like test1.example.com test2.example.com etc.
So far I read and did many things but with no success yet. I'll be very thankful if you can help me.
So to start I'm using ubuntu 12.10 as my desktop and I've set up apache server there. I've added example.com in hosts resolving to 127.0.0.1. So far no problems. I've enable vhost_alias and mod_rewrite in apache and I'm using this for my virtual server
NameVirtualHost *:80
UseCanonicalName Off
<VirtualHost *:80>
ServerName example.com
ServerAlias *.example.com
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?([^\.]+).example.com$
RewriteRule ^(.*) $1 [F]
VirtualDocumentRoot /home/example/server/projects/%1/public_html
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /home/radoslav/server/projects>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
#log file for this server
CustomLog /var/log/apache2/example.com.log combined
</VirtualHost>
But when I open test.example.com it says that browser can find test.example.com, no matter that I have this directory in the path specified. Just to clear things up apache have permissions to read this directory so it's not this. When I ping example.com from console I get ping but if I ping test.example.com I get error that can not find host. As you can see obviously it's not resolving the adress no matter that I've setup everything correcly.
Any help guys?
You need to add test.example.com and any other hostnames you want to use in the host file. The host file does not supports wildcard.

Resources