Why is /etc/apache2/sites-enabled/default returning blank? - apache

I just installed a LAMP stack and when I ran sudo nano /etc/apache2/sites-enabled/default, it was empty, like whatever file it opened doesn't exist. Never had this problem on my last LAMP install. What's going on?

The files in Apache's sites-enabled directory are ordered, which means that the filenames start with a number. The default site is usually named 000-default or similar, not just default. Take a look in the directory to see what's there with ls, then edit that file with nano.
> ls -l /etc/apache2/sites-enabled
lrwxrwxrwx 1 root root 26 Nov 14 2013 000-default -> ../sites-available/default
> sudo nano /etc/apache2/sites-enabled/000-default

Hello thank you i get also this issue, as mentionned by Brian Kintz, I did
ls -l /etc/apache2/sites-enabled
and get line like :
lrwxrwxrwx 1 root root 26 Nov 14 2013 000-default -> ../sites-available/default
I try to edit it :
sudo nano /etc/apache2/sites-enabled/000-default
I have only virtualhost block inside this file.
Thank you

Related

SSH/Fuse mount create file ok but can't delete it

I have a proxmox server so under debian, and I want to mount a remote directory from my Nas Synologies to make backups.
I normally use ssh mounts without any problem.
But this time I have an error that I have never encountered, I can create files, but not delete them.
I find this very strange and I don't see where this can come from
root#proxmox:/mnt/# sshfs user#192.168.0.1:home/data /mnt/dist-folder/ -o reconnect,
ServerAliveInterval=60,ServerAliveCountMax=30,allow_other,
default_permissions,uid=0,gid=0,umask=007
root#proxmox:/mnt# cd dist-folder/
root#proxmox:/mnt/dist-folder# touch aa.txt
root#proxmox:/mnt/dist-folder# ls -la
total 12
drwxrwx--- 1 root root 114 Mar 13 09:53 .
drwxr-xr-x 7 root root 4096 Mar 13 09:37 ..
-rwxrwx--- 1 root root 0 Mar 13 09:53 aa.txt
root#proxmox:/mnt/dist-folder# rm aa.txt
rm: cannot remove 'aa.txt': Permission denied
With uid=0,gid=0 for root user and group
Thanks
This is finally a problem specific to synology.
For the assembly of the file it is absolutely necessary to respect the path by starting with
/homes/<user>home/
So it's give
sshfs user#192.168.0.1:/homes/proxmox/home/data /mnt/dist-folder/
And it's works fine !
It's not the first time that I have an abnormal configuration for this synology tool... AGrrrr

Composer Akeneo installation Could not open input file composer.phar

I am trying to install a PIM named Akeneo. The system requirements are all checked:
https://docs.akeneo.com/2.3/install_pim/manual/system_requirements/system_requirements.html
I am on Apache2 / Ubuntu 16.04
My /var/www/ directory all belongs to www-data:www-data ( ran chown -R www-data:www-data to install )
Error message from server : “Could not open input file: composer.phar”
Googled about it , got many results, and looked on the forums on stakoverflow, found answers from 2010 to 2018. I think I have maybe found out that the problem could be linked with the file "composer.phar", the way symlinks work on apache2, and composer installed globally or "inside individual project(s)".
Following 2 tutorials, I had to install composer to continue the install for that PIM.
My server says:
Composer (version 1.10.10) successfully installed to:
/usr/local/bin/composer
If I navigate to cd ~ and run ls I see there is "composer.phar" and "composer-setup.php" here.
I am confused because the Akeno tutorial says:
After extracting the file, change into the Akeneo directory and run
the commands below:
cd /var/www/html/akeneo/pim-community-standard
sudo php -d memory_limit=3G ../composer.phar install --optimize-autoloader --prefer-dist
sudo php bin/console cache:clear --no-warmup --env=prod
...
I don't understand the composer.phar install part . There are no composer.phar file inside any directories : not in /var/www/html/akeneo/ and not in /var/www/html/akeneo/pim-community-standard
Was it supposed to generate a composer.phar file there ? Should it find composer.phar one level above ( ../composer.phar ) ? I doubled checked the Akeneo PIM files , and the original .rar archive has no composer.phar file. Or, is it something to do with a symlink that accesses the global "composer.phar" which was with the global install ? Regarding symlinks, there are some in the "vendor" fodler of the PIM, and runing ls -l -a gives :
lrwxrwxrwx 1 www-data www-data 28 Feb 5 2020 doctrine -> ../doctrine/orm/bin/doctrine
lrwxrwxrwx 1 www-data www-data 34 Feb 5 2020 doctrine-dbal -> ../doctrine/dbal/bin/doctrine-dbal
lrwxrwxrwx 1 www-data www-data 46 Feb 5 2020 doctrine-migrations -> ../doctrine/migrations/bin/doctrine-migrations
lrwxrwxrwx 1 www-data www-data 56 Feb 5 2020 requirements-checker -> ../symfony/requirements-checker/bin/requirements-checker
lrwxrwxrwx 1 www-data www-data 51 Feb 5 2020 var-dump-server -> ../symfony/var-dumper/Resources/bin/var-dump-server
There is a composer.json and composer.lock file inside /var/www/html/akeneo/pim-community-standard . So confused because the turorial says to be inside pim-community-standard directory and run this : php -d memory_limit=3G ../composer.phar install --optimize-autoloader --prefer-dist
I hope I can resume the install without breaking anything. Some posts give the solution of updating composer, or installing composer-phar, inside the project. I am honestly totally lost.
( I don't know if I should bring that up, but is docker needed (not talked about in tutorial - but I see a folder with "docker" in it and I know that composer and docker can work together sometimes )
I moved the composer.phar file into the app directory. Now the install advanced. It's not a technical issue a misconfiguration or anything like that.
It's a lack of information about Composer on the Akeneo site but it's probably assumed that users should have knowledge about Composer allready.
Solution for me : moving the "composer.phar" file (from 'home' for me ) to the /var/www/project/ (.. the correct level directory).
So for my case it was a global / local install issue , which is still unclear, and I will have to look deeper how to properly install composer. Not sure if my current setup will not cause any issue later since it's like I installed it globally at first then moved only one file.
Also, command "composer" is not returning anything. I do have the composer file in /usr/bin/ though. This is very strange.

Jenkins user cannot copy files to Apache /var/www folder - all permissions appropriate

Jenkins installed on Ubuntu 18.04 and running successfully.
As part of our project build process, we need to copy built files to a specific folder under /var/www/html (Apache folder). Our build / Execute shell:
npm install
ng build --prod
cp -R /var/lib/jenkins/workspace/kagi-core/dist/core/* /var/www/html/kagi-core/
But jenkins build fails at the final copy command with the following errors:
23:18:10 + cp -R /var/lib/jenkins/workspace/kagi-core/dist/core/3rdpartylicenses.txt /var/lib/jenkins/workspace/kagi-core/dist/core/assets ...
23:18:10 cp: cannot create regular file '/var/www/html/kagi-core/3rdpartylicenses.txt': Permission denied
...
...
Here's what we did/tried so far:
Added "jenkins" user to root and ubuntu groups.
ubuntu#ip-172-31-15-215:/var/www/html$ groups jenkins
jenkins : jenkins root ubuntu
Changed permissions on /var/www/html/kagi-core folders to "jenkins" user
drwxr-xr-x 3 ubuntu jenkins 4096 Sep 17 21:36 www
..
drwxr-xr-x 3 ubuntu jenkins 4096 Sep 18 21:04 html
..
drwxrwxrwx 4 ubuntu jenkins 4096 Sep 18 21:18 kagi-core
What are we missing? Appreciate any help!
While trying to fix this, found the solution. Adding here for reference:
On observing carefully, the permissions to /var/www folders, they are as
drwxr-xr-x 3 ubuntu jenkins 4096 Sep 17 21:36 www
but instead they should be the other way around (allow "jenkins" user to the default group):
drwxr-xr-x 3 jenkins ubuntu 4096 Sep 17 21:36 www
Also we reset the group to default root
So the command that solved the issue was
cd /var
sudo chown -R jenkins:root www/
After this, jenkins builds were successful (able to copy to the /var/www/html folder).

What does a2ensite do apart from creating a symlink?

I regularly use a2ensite and a2dissite to enable and disable sites in Apache. As far as I know it does little more than simply creating a symlink from /etc/apache2/sites-enabled to /etc/apache2/sites-available. I can also do it manually, but because it saves me typing a few characters I use these shortcuts.
I just did a cat /usr/sbin/a2ensite, and to my surprise it's quite an elaborate program. According to the man pages, it does little more than enabling sites though. I briefly looked over the (Perl) source code, but even though it's a lot of code I don't really understand what it does more than simply creating a symlink.
Why does it need so much code to simply create a symlink? What am I missing here?
Actually
a2enconf
a2disconf
a2dismod
a2ensite
a2dissite
are all only symlinks to a2enmod:
$ /usr/sbin$ ll -d a2*
lrwxrwxrwx 1 root root 7 Jul 15 17:33 a2disconf -> a2enmod
lrwxrwxrwx 1 root root 7 Jul 15 17:33 a2dismod -> a2enmod
lrwxrwxrwx 1 root root 7 Jul 15 17:33 a2dissite -> a2enmod
lrwxrwxrwx 1 root root 7 Jul 15 17:33 a2enconf -> a2enmod
-rwxr-xr-x 1 root root 15424 Apr 5 2016 a2enmod
lrwxrwxrwx 1 root root 7 Jul 15 17:33 a2ensite -> a2enmod
-rwxr-xr-x 1 root root 9870 Jul 15 17:33 a2query
and a2enmod implements the functionality of all six of them in one script.
It decides what to do depending on $0 (i.e. the name the script was called with).
That's probably the reason why it's more complicated than a simple ln -s.

"Symbolic link not allowed or link target not accessible" on fresh installed XAMPP for Linux

I did a fresh-install of XAMPP for Linux (version 1.7.4) on my Ubuntu 11.04 x64 laptop.
Then I made a link in my htdocs folder to my project folder:
$pwd
/opt/lampp/htdocs
$sudo ln -s /home/petra/projects/webapp webapp
$ls -al
drwxr-xr-x 4 nobody root 4096 2011-08-18 11:58 .
drwxr-xr-x 18 root root 4096 2011-01-25 15:33 ..
lrwxrwxrwx 1 root root 26 2011-08-18 11:42 webapp -> /home/petra/projects/webapp
When I opened the webapp in the browser using http://localhost/webapp, it only showed "403 Access Forbidden". The error log said:
$tail -f /opt/lampp/logs/error_log
[Thu Aug 18 11:43:15 2011] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /opt/lampp/htdocs/webapp
Here is the httpd.conf. Strangely, the FollowSymLinks options are already defined (default).
There is a similar question on the XAMPP forum but I think nobody seems to pay attention to it anymore.
Does anyone have an idea how to fix this?
Try to run Apache using your user.
By default Apache runs as "www-data" so edit your apache2.conf, and search for "user" and set:
user=youruser
Restart Apache and voilà, it should work.
I found out that if I use link from directory outside /home/petra, the web-app is working normally. I guess it's because I use Encrypted Home Directory setting on my Ubuntu.
I just have to move the project directory outside my home directory to make it work.
I ran into this problem when I symlinked the document root to code sitting on my encrypted home directory. I also solved it by running apache as the user who owned the encrypted content.