Can't find the /var/www/test/ directory (Mac OSX) - python-3.x

I'm learning python and now I arrived at 'The web' where I'm told about Apache. They ask me to create a simple file (see below) and save it as /var/www/test/home.wsgi but I can't find a directory like this and don't understand what I have to do here.
I looked for the directory but can't find it, then I started searching on google but can't find the solution.
import bottle
application = bottle.default_app()
#bottle.route('/')
def home():
return "apache and wsgi, sitting in a tree"
Anyone got any idea of what to do here?

/var/www/ is typically the root folder used by Apache for its hosted files. If it doesn't exist on your system, chances are you do not have Apache installed or have it configured to use a different folder.
On my Macbook I was able to track down this folder by checking the DocumentRoot setting in /etc/apache2/httpd.conf.
Not sure what you are trying to do in the grand scheme of things but chances are you will have to configure Apache properly before being able to visit files in your root folder through http://localhost/.

Related

Spring Tool Suite 3.8.2 - Installation on Ubuntu

I managed to install STS 3.8.2 on Ubuntu 16.04 - with a lot of hacking experiments. I have it working, but I am not happy with my solution.
Here is what I had to do:
Extracted the tar file into /opt/sts-bundle.
If you put it anywhere else, like /opt/sts, the TC server fails to start from STS.
With files in /opt/sts-bundle, TC server still fails to start from STS - permission errors. To get it to work you need to futz around with permissions of the pivotal-c-server subdirectories, essentially you need to open it up your group (the same one running STS) (security hole ?).
A local install in your own ~/sts-bundle fails on "files not found" while attempting to backup - all the conf files. It still looks in /opt/sts-bundle for all these config files (just to copy them to /backup). You can change the top directory of the server in STS server properties - but it still looks in /opt/sts-bundle. Seems hard-coded - don't know where. So you have to create all the config files in the conf directory in the tree rooted at /opt/sts-bundle ("touch" works - creating empty files). TC Server still fails to start with a "failed to clean" error - with no clue from the detailed message what files are being "cleaned".
I tried creating a non-privileged user "tcserver" per suggestion from the Pivotal TC Server docs. I installed to /opt/sts-bundle, while logged in as tcserver (with sudo privileges). That fails when I am using STS as a regular developer that is not "tcserver". Could not figure out how to tell TC server to run under a different user than the one that started STS.
The solution I have working and I am not happy with, starts by extracting the tar.gz file into /opt/sts-bundle, as it wants. Then changing owner and group of sts-bundle to my id and my group (same ones that are used in STS UI). I am not happy with that. It seems wrong to put things in /opt that are owned by a single developer.
I am new to Linux, and I still have some Windows habits that need to be unlearned.
The question is: how do I get the clean solution (installing using a "tcserver" user in the global /opt directory) to work for developers who are not "tcserver"? How should the tcserver user be related to the developers (same group?).
Am I making this problem harder than it should be? What am I missing?
I'm not sure this what you want, but I don't install the STS bundles in some kind of shared directory as a special user at all. I just install it in my user.home dir, as myself, and launch it from there.
It is very unsophisticated. I just download the tar.gz file, unpack it in my home dir and then launch it from a trivial bash script which looks something like this:
#!/bin/bash
/home/kdvolder/Applications/sts-bundle/sts-*/STS
That script is on my PATH. So I can just type 'STS' in a terminal and STS will start.
I don't have to do anything else and it works.
If you are trying to somehow install this so that several different users can run a shared installation then this isn't a good setup. But I think for your own personal laptop or desktop which only you are using, this simple setup is perfectly fine.
For a shared-user env, unfortunately, I don't know how to help you. It could be complicated to sort out all the permissions issues etc because Eclipse is a complicated beast w.r.t to installation of plugins etc.

Is there a security risk to having node.js installed on a shared server?

I have installed "node.js" on a shared server. I have rename the directory so that it can not be found easily. Also I have my node directory in a location above /public_html.
I have also installed node on my PC for programming and testing easy on my local system vrs my web server.
What I would like to know is does this create a security risk where someone could hack my sites if they knew where my node installation files exist?
I have not added the path to my bash, so the commands have to be executed manually by using the ~ representing home, and the path. Such as:
~/pathtodir/bin/npm -v

Cannot run scripts using VirtualBox with Ubuntu installed

I'm doing a tutorial through lydna.com on setting up linux using virtualbox.
It was going fine until I had to create a file in my development folder. It's been set up as a shared folder so I can write html files straight on to the virtual server (I think).
I'm writing small scripts in to the shared folder and I'm getting a 404 error for each. For something like http://sandbox.dev:8080/errors.php or http://sandbox.dev:8080/hello.html (with just a 'hello world' in there).
Additional Info;
In VirtualBox if I go settings->shared folders->machine folders, my 'sandbox' folder is definitely the one being used.
When I go to http://sandbox.dev:8080/server-status - it works as expected. Information about the server.
I have installed Ubuntu 14.04 LTS. I've installed a lot of packages. Things started going wrong on the 'Configuring the Apache web server' section so maybe it's an apache problem.
I have looked on the server through the command line at /var/www/html. It's looks nothing like the shared folder. Just one index.html which - when looking at it in nano - tells me it's the default ubuntu homepage. But I cannot navigate to it in the URL at all.
Can someone help?
Update apache2.conf by adding directory directive similar but according to your folder's path:
<Directory /mnt/hgfs/sandbox"
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
My confusion was similar to yours - the link sandbox.dev/server-status works, so why not anything else.
By the way I am having this issue because I am adjusting the Jon Peck's instructions to VMware Fusion and Workstation. On VM Workstation no problems what so ever, but my preferred dev environment is on OS X and there VM Fusion (Pro 7.0.1) behave different from its Windows sister - the line .host:/ in the file /etc/fstab doesn't have effect where the share folder sandbox is - it goes by default under /mnt/hgfs.
I gave up adjusting VM Fusion - even open-vm-tools could not help, so will follow Jon Peck's instructions to the letter with VirtualBox and I can share with you if I will have that issue.

Linux: Installation directory of application installed only for current user

I have a Python application that is currently installed following Linux Filesystem Standard Hierarchy (FHS). It is installed in:
/usr/bin/ (executable)
/usr/lib/python2.x/site-packages/{appname}/ (Python libs)
/etc/{appname}/ (conf files)
/usr/share/man/ (manual files)
Now, it is desired that a non-root user installing this application could install it without root powers and that only this user could run the app. We thought the best would be to install the app in user home directory.
We already have a .{appname} directory in user home to keep per-user configuration files, as the app installed configuration files in /etc.
I think that using the .{appname} dir to keep all application files is not a good idea, as directories pre-appended with . only keeps configuration files. Probably I'll remove the .{appname} dir, as the entire application will be installed per-user now.
2 ideas:
Create a {appname} dir and create subdirs bin, etc, lib and share/man.
Replicate Linux FHS under home and create a {app-name} subdir under lib and etc
~/bin/
~/lib/{appname}
~/share/man/
~/etc/{appname}
Which one of these is more often used and more recommended? Pros and cons of each alternative are welcome. Maybe a third option?
I've seen people recommend /home/usr/bin and /home/usr/local/bin, but I don't understand the need to include the usr here as there is no need to differentiate between essential and non-essential binaries/libraries. I'd prefer to be minimalist.
Thanks in advance.
The first option is the most common. A third option is to create (or fill out) the structure under ~/.local/ (which reflects /usr) that is already used by a number of applications for share/.

Timthumb and tmp folder

Recently a web space ran out of space. Now I found out that the tmp folder outside the home directory was full of these files: timthumb_tmpimg_00BZyC. Some of these files can't be opened. Why is timthumb storing files outside the home directory? The tmp folder is on the same level like dev, etc, proc, root, sys and so on.
Has the site a security problem? Are some settings incorrect?
Timthumb is used in version 2.8.5 by the Wordpress plugin vSlider. The site also uses Simple Post Thumbnails which uses Timthumb in v. 2.7. I replaced both with Timthumb 2.8.10.
Or does it have to do with temporary files created by timthumb, which were never deleted?
/tmp is intended to be world-writeable -- though if you try the following:
ls -l / | grep tmp
you'll see that it has the sticky (t) bit on, meaning that files created by a user can only be deleted by the same user or a superuser, to prevent different users from clobbering each other's temporary files. This is similar to the %SYSTEMDIR%\TEMP directory in Windows.
So it's not a security problem on the Linux side, though it could be a misconfiguration or a bug on the part of the WordPress plugin you're using. Is there an option limiting how many thumbnails it keeps?

Resources