Setting up DVWA with XAMPP on virtual Ubuntu - linux

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.

Related

Ubuntu Desktop 20.04 - Apache2 without VirtualHost Configuration presents Website

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

noVNC Multiple Localhost Servers

Ive got 4 dev VMs for four projects (all VMware Player VMs w/ubuntu 15.04 host) where each is running VNC (ports 5900, 5901, 5902, 5903) respectively.
I downloaded noVNC and saved to /var/www/html (my apache2 server on same host). Based on the ReadMe I then ran on my terminal
./utils/launch.sh --vnc localhost:5900
I received a missing websockify error, so downloaded it and placed it into the util folder. I then ran the same command and it worked! The terminal told me to Navigate to a url and sure enough I could control my VM.
However -- I'm wondering how can I use noVnc to access all 4 VM's? Is there some simple way to extend the port to a range like in iptables or firewalld?
./utils/launch.sh --vnc localhost:5900-5903
Okay, Ill answer for myself here in case it helps someone in the future...
First, create a token file where each line has a nickname, ip address, and port.
I created a file named token.list where each line looks like:
localhostnickname1: localhost:5900
localhostnickname2: localhost:5901
...
Then I use my terminal to go into the websockify folder so I can see the run file. I issue it the command:
./run --web /path/to/noVNC --target-config /path/to/token.list localhost:6080
Finally, I open my web browser and go to :
http://localhost:6080/vnc_auto.html?path=?token=localhostnickname1
Where localhost1 is the nickname of my first server on the first line of token.list
This link was my reference. If you want to serve this outside of localhost -- change the parameter localhost:8060 from localhost to an IP

Symlink to raspberry pi webroot breaks

I have my raspberry pi setup as an internal web server. I have an external hard drive connected to the pi and mounted correctly.
I then symlink two folders from the hard drive to the web root on the pi, one is /Movies, and the other is /Series.
Initially this all works fine, as in if I hit http://192.168.1.17/Movies I get a list of all the files, I then click one and it starts playing no problem. However, after leaving it for a while and coming back, I can still get to the file directory in /Movies or /Series, but when I click a file, the web browser cannot open it.
I have no idea what's going on, it seems weird that I can still access the file directory, but playing a file doesn't work?
Any thoughts or help appreciated.
Are you using an apache server?
If so Symlinking is not a good idea.
An alternative which is more secure and may fix your problem is to install Userdir
sudo a2enmod userdir
Then you need to make a directory in home
mkdir public_html
Restart Apache
sudo service apache2 restart
If you want to change the home directory apache points to you can do so in /etc/apache2/mods-enabled/userdir.conf .Then change the <Directory /home/*/public_html> to the directory you want.
To access you're server simply enter ip_of_Rpi/~pi_username. e.g 192.168.0.100/~pi
more details here: http://ubuntuserverguide.com/2012/10/how-to-enable-and-configure-apache2-userdir-module-in-ubuntu-server-12-04.html
If you are using Apache web server, you can use mod_alias to map some directory in a URL path like this
Alias /mnt/external_disk01/movies /Movies
Alias /mnt/external_disk02/series /Series
Before use alias, make sure it is activated.
To activate:
a2enmod alias
more info in http://httpd.apache.org/docs/2.2/mod/mod_alias.html

Setting up a local.host alias for localhost on windows

I'm trying to setup everyauth for my node app. Although I've reached a step that I have no idea how to accomplish.
It's asking to setup local.host as an alias for localhost, but it references some linux folders, I'm using windows.
Here's the exact instructions I'm stumped on.
Important - Some OAuth Providers do not allow callbacks to localhost, so you will need to create a localhost alias called local.host. Make sure you set up your /etc/hosts so that 127.0.0.1 is also associated with 'local.host'. So inside your /etc/hosts file, one of the lines will look like: '127.0.0.1 localhost local.host'
(source here)
How do you accomplish this on windows?
This can be done by editing you hosts file. Open notepad++ (or notepad) as admin. Then hit open, and select C:\Windows\System32\drivers\etc\hosts. You will see:
# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# ...
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
::1 localhost
And add this line at the end:
127.0.0.1 local.host
Save and you're done
Regarding the answer (Add the entry to your HOSTS file)
This does not work entirely on Windows 10, Windows Server 2019. You CAN PING the new alias (ping local.host), but it you try to use it in windows explorer (\local.host), you get a login prompt that will always fail. Check the EVENT viewer and you will see:
Audit Failure ... A privileged service was called. . . .
C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe
Service Request Information: Privileges: SeTcbPrivilege
I've found no way around this.
So the answer is technically correct, but may not work in all cases.

Ubuntu Server VMware www folder not working

I have an Ubuntu server setup in VMware workstation and if you load the IP from ifconfig you get "Apache2 Ubuntu Default Page" with the messsage "It works!"
However when I put a file into /var/www like info.php and then attempt to load that page using serverip/info.php i get 404 not found.
I have checked the directory and tried many files in the www folder but nothing seems to work :(
So it turns out the files needed to be put in /var/www/html folder
I don't know why even though apache2.conf states /www/ folder as be accessible by web
this is the folder where the actually files need to be :o

Resources