setting default directory on raspberry pi - raspberry-pi

I recently tried to install php on my raspberry pi, and a web server. By doing so the default location of user pi is now var/www, but it used to be /home/pi. How can I change it back to the way it was?

The most proper way is to use Virtual Hosts in the directory : /etc/apache2/sites-available/
The default is pointing to /var/www/
I'm always creating a user for a project and then I point the Virtual Host and I use SuPHP for the security.
To solve your problem, look at the file /etc/apache2/sites-available/default
Edit :
is it a problem related to apache and php or system/unix ?

Related

How to enable the Raspberry Pi 4 to work remotely?

Anyone knows how to operate the Raspberry Pi 4 remotely? So that I don't need to always connect it to a monitor when I want to use it.
My Pi is Raspberry Pi 4 with Yocto image built inside. I wonder how to configure the Pi so that it can be used remotely without the need to connect to a monitor. Any helps will be appreciated!
If you're using the Yocto reference distro 'Poky', then you can enable one of the following IMAGE_FEATUREs:
ssh-server-dropbear (uses Dropbear SSH)
ssh-server-openssh (uses OpenSSH)
and that will start a SSH server at boot.
A quick way to do this, is to add the following to your local.conf:
# local.conf
EXTRA_IMAGE_FEATURES += "ssh-server-dropbear"
A more permanent solution is to define a custom image recipe:
# my-custom-image.bb
require core-image-minimal.bb
DESCRIPTION = "A small image with a SSH server for remote access"
IMAGE_FEATURES += "ssh-server-dropbear"
Alternatively, if you already have your own Yocto configurations - just add either the dropbear or openssh package to your image/packagegroups.

Installing Ravendb on the Raspberry Pi

I'm currently trying to install Ravendb 4.1.5-patch-41012 for the Raspberry Pi on my Raspberry Pi 3 Model B running Raspbian Stretch Lite. When I run the run.sh script it will give an error about not being able to open a browser even if I set the Setup.Mode in the settings to none. After that I'm able to run server commands but I'm not able to access Ravendb studio and the Ravendb server locally or using my local network. Are there extra steps I have to take and or thing I have to keep in mind when installing Ravendb on the Raspberry Pi?
Raspbian Stretch Lite doesn't equipped with local web browser, therefor you may need to give outside access before using web setup. In the following link you can find description on the Server's configuration: https://ravendb.net/docs/article-page/4.1/csharp/server/configuration/configuration-options
Modify Server/settings.json in a way it fits your security needs, as follows (Replace 10.0.0.90 with your Pie's IP)
Totally unsecured access from anywhere (ATTENTION: This will give access to the database to any one with access to this docker instance):
{
"ServerUrl": "http://0.0.0.0:8080",
"PublicServerUrl": "http://10.0.0.90:8080",
"Setup.Mode": "None",
"Security.UnsecuredAccessAllowed": "PublicNetwork",
}
Access from docker's host machine or other machines on you local LAN:
{
"ServerUrl": "http://10.0.0.90:8080",
"Setup.Mode": "None",
"PublicServerUrl": "http://10.0.0.90:8080",
"Security.UnsecuredAccessAllowed": "PrivateNetwork",
"License.Eula.Accepted": true
}
Browsing to http://10.0.0.90:8080 should work at this point.
You can use cli, read : https://ravendb.net/docs/article-page/4.1/Csharp/server/configuration/command-line-arguments
Example:
cd ~/RavenDB/Server
./Raven.Server --Security.UnsecuredAccessAllowed=PublicNetwork --ServerUrl=http://0.0.0.0:8080 --PublicServerUrl=http://10.0.0.90:8080 --Setup.Mode="None" --DataDir=/mnt/ExternalDisk/RavenDB
As a side note: I do recommend to set "DataDir" to external mounted USB disk, rather then using the default SD card data path, if this is your case.
And later on you may want to use scripts for adding RavenDB as service on your Pie (see install-daemon.sh here : https://github.com/ravendb/ravendb/tree/v4.2/scripts/linux)
The run.sh is trying to start a browser the first time you start RavenDB to give you access to it. Given that you are running the Lite version, there is no such browser, obviously.
See Adi's comment on how to access RavenDB from outside the Pi machine.
You can just call server/Raven.Server instead of the run.sh instead to start RavenDB

Mount any USB key plug on a port usb in the same folder

I'm currently working on a embedded application on a raspberry pi 3 with Raspbian Jessie. The purpose of this applicatin is to write data in an excel on any usb key (which is always plug on the same port on the raspberry pi)
Current State
Currently, the path where i want the data is directly written in my code
USBadress='/media/pi/DATA3'
Problem
If the usb key is mounted elsewhere or if i'm using a different USB key my application doesn't work
What I tried
Modify the fstab to automaticlly mount /dev/sda1 on a specified folder (ex : media/pi/genericFolder but sometimes the usb key path is different (/dev/sdb1) and this solution only seems to work if you turn on your pi with your usb key already plug (which will be not be true everytime in my case)
I also tried with the UUID but this solution can't work cause my goal is to have a generic solution working with any usb key i plug in this specific usb port
I also saw some solutions with a rule specified on udev but I didn't understand very well...
Thank you in advance !!
Finally found a solution with the following line :
myPath=str(os.popen("mount | grep /media/pi").readlines())
MyPath=MyPath.split(" ")[2]

Raspberry webserver change website name

In my browser i can type 192.168.178.33:8000 to access the webpages on my raspberry or
http://raspberrypi:8000/
Somewhere must be set that the web browser translate http://raspberrypi:8000/ into 192.168.178.33:8000 I tried to find a nameserver but I've no idea what or where I can change this
Is there a simple way to change
http://raspberrypi:8000/ into http://whateverIWantHere:8000/
You can edit your hosts file. The location is different for each OS and may also be different for different versions of the OS. Note that you only need to do the changes on the computer where you want to translate it.
Windows 10:
C:\Windows\System32\Drivers\etc\hosts
Linux/Raspbian:
/etc/hosts
Add the following line to the end of the file:
192.168.178.33 raspberrypi
You may have to restart, I'm not sure if the changes will apply immediately. And you can now type 192.168.178.33:8080 in your browser.

configure users using opensips 1.11(Ubuntu 14.04)

After installing opensips(It will be better if i won't have to use opensips control panel) how can add users and can make test call.
Note:
I am a newbie, and following this guide for installation.
http://www.opensips.org/Documentation/Install-CompileAndInstall-1-11
Instead of using the Control Panel, you can use opensipsctl in order to add new subscribers. All you need to do is:
opensipsctl add liviu#opensips.org mypassword
For more help on the opensipsctl, simply type:
opensipsctl
For any user that's trying to install the package under Ubuntu by instructions from official manual, please make sure that you also read setup manual from github page, section [C] and [D]
https://github.com/OpenSIPS/opensips/blob/master/INSTALL
I've tried to do a fresh setup of opensips on a virtual machine to test the functions. The provided packages on Jessie branch of Debian (which is supported by Ubuntu 14.04) is not included MySQL database deployment.
For a quick test I'm using the DBText as DB engine, and using command to add user will not succeed. Because the DBText engine requires email field, however the opensipsctl interface doesn't understand, so we should add some subscribers by adding some lines to Subscriber table, basically is located under path /usr/local/etc/opensips/dbtext, e.g:
1:brian:192.168.186.129:password:123456:xxx:xxx:xxx
2:julia:192.168.186.129:password:123456:xxx:xxx:xxx
Example above using the ip which is the virtual machine ip.
Good luck.