How to install basic auth on graphite and grafana - graphite

I've installed Graphite and grafana and all is working correctly.
I need to add basic authentication for graphite and grafana.
How can I do that?
Graphite conf file:
/etc/apache2/sites-enabled/graphite.conf
<VirtualHost *:80>
WSGIDaemonProcess _graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 user=_graphite group=_graphite
WSGIProcessGroup _graphite
WSGIImportScript /usr/share/graphite-web/graphite.wsgi process-group=_graphite application-group=%{GLOBAL}
WSGIScriptAlias / /usr/share/graphite-web/graphite.wsgi
Alias /content/ /usr/share/graphite-web/static/
<Location "/content/">
SetHandler None
</Location>
ErrorLog ${APACHE_LOG_DIR}/graphite-web_error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/graphite-web_access.log combined
</VirtualHost>

try to access your graphite dist in python packlages:
e.g
cd /usr/lib/python2.7/dist-packages/graphite
the you should have a file manage.py
run:
python manage.py migrate auth
you might also need to run:
graphite-manage syncdb

Related

I Can't reset apache. (Linux)

I tried to install an ssl certificate, I follow an aws "link" tutorial, when I try to restart the apache server the console shows me the error: Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
use command apachectl configtest the console shows me the error: SSLCertificateKeyFile: file '/etc/pki/tls/private/localhost.key' does not exist or is empty
After following the steps in the tutorial my page no longer works because I did not finish installing the ssl certificate. How could I solve it or return the configuration prior to the change?
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Try this as your default configuration file and restart apache. If required, modify the Document Root to your actual file serving location.

Symfony 5 - Installing API on VPS

i've installed a Symfony on my local LAMP. It works.
Then i've used the "composer require api" it works (with php -S 127.0.0.1:8000 -t public).
I've done the same thing on my VPS (same conf). Symfony OK. But API NOK without php -S domain.name:8000 -t public. But with php -S 127.0.0.1:8000 -t public it is working.
Here my VirtualHost :
<VirtualHost *:80>
# ...
DocumentRoot /var/www/html/A2SAPI/public
<Directory /var/www/html/A2SAPI/public>
AllowOverride None
Order Allow,Deny
Allow from All
# Copy .htaccess contents here
</Directory>
</VirtualHost>
<VirtualHost *:8000>
# ...
DocumentRoot /var/www/html/A2SAPI/public
<Directory /var/www/html/A2SAPI/public>
AllowOverride None
Order Allow,Deny
Allow from All
# Copy .htaccess contents here
</Directory>
</VirtualHost>
I don't know how to setup correctly the VirtualHost.
Thanks in advance
From the PHP docs:
Warning
This web server is designed to aid application development. It may also be useful for testing purposes or for application demonstrations that are run in controlled environments. It is not intended to be a full-featured web server. It should not be used on a public network.
You should really look in to having Apache handle the PHP instead of using the PHP dev internal server. If you are looking for an easier alternative to Apache I strongly recommend Caddy server (https://caddyserver.com/)
Otherwise make sure Composer is either installed or that all dependencies of the api bundle have been copied to your server.

How to set Symfony3 environment in Apache

I am running Apache 2.4 on my development machine so I can test code locally. How do I tell Symfony 3.4 to use the 'dev' environment instead of the 'prod' environment?
I've tried browsing to http://localhost/app_dev.php but that just redirects to http://localhost/. It looks like the front controller is set in .htaccess but if I modify that file, then my production server will be using the wrong front controller.
I've read the docs on the following pages and it talks about how to create new environments but not how to set the default environment.
https://symfony.com/doc/3.4/configuration/environments.html
https://symfony.com/doc/3.4/setup/web_server_configuration.html
I'm running Apache 2.4 on Windows 10 and here is my vhost configuration
<VirtualHost *:80>
ServerName example.local
DocumentRoot "C:\Users\kento\PhpstormProjects\example\web"
<Directory "C:\Users\kento\PhpstormProjects\example\web">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex app_dev.php
</Directory>
ErrorLog "logs/example-error.log"
CustomLog "logs/example-access.log" common
</VirtualHost>
example.local points to 127.0.0.1 in my hosts file. I set DirectoryIndex to app_dev.php but that seems to be overridden by the .htaccess file.
You've already set the vhost to use app_dev.php, but then you allow a .htaccess to override with the AllowOverride All. Change that to AllowOverride None and the .htaccess will be ignored.
There may be some config from there you would be able to merge into the vhost.
I tend to prefer all the configuration in the virtual host, and not have any use of a .htaccess file, for a small speed boost - especially in production.

Symfony not loading up in EC2 instance AWS

I have a symfony website on digital ocean droplet, i am trying to migrate symfony website to aws ec2 instance. This is the tutorial i have followed : Deploy Symfony on Ubunut 14.04
I have followed each and every step according to the tutorial and have installed composer and other prerequisites needed. Here is the sites-available default config file for apache on my server :
<VirtualHost *:80>
ServerName miscellani.co
ServerAdmin info#miscellani.co
DocumentRoot /var/www/miscellani/web
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
But even after setting all the parameter files and everything apache is not loading up the correct index for the file but showing directories.
Output image
I have tried multiple tutorials but all showing the same output for symfony. If anyone can help me out here where i am doing it wrong or which file i need to install or redo any step it will be highly appreciated. Thank you.
Update :
Made changes as recommended by Jan but its still giving me the same parent directory rather than the website.
1st add to /etc/hosts:
127.0.0.1 localhost
127.0.0.1 miscellani.co
127.0.0.1 www.miscellani.co
Run in shell
sudo cp 000-default.conf miscellani.conf
edit miscellani.conf
Correct VirtualHost for Symfony is (miscellani.conf):
<VirtualHost *:80>
ServerName miscellani.co
ServerAlias www.miscellani.co
DocumentRoot /var/www/miscellani/web
<Directory /var/www/miscellani/web >
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
When add file run in shell command:
sudo a2enmod rewrite
sudo a2ensite miscellani
sudo service apache2 restart

wordpress forbidden 403 error

After installing wordpress and following all the steps when I am go to http://localhost, I am gettong 403 Forbidden error.
How can I resolve this?
Ubuntu 14.04 is my OS.
In normal case changing permission and updating .htaccess should fix this issue, but in your case it is not working, so try to create a host entry and see if it is working. Else it will be related to the server configuration.
a. Create a new folder inside /var/www (example: wordpress - with proper permissions)
b. Copy all files from /var/www/html folder to /var/www/wordpress
c. Create a virtual host entry: sudo gedit /etc/apache2/sites-available/wordpress.conf
Add following contents:
<VirtualHost *:80>
ServerName wordpress
DocumentRoot /var/www/wordpress
<Directory /var/www/wordpress>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
</VirtualHost>
d. Update hosts: sudo gedit /etc/hosts
Add new line: 127.0.1.1 wordpress
e. Activate new website: sudo a2ensite wordpress.conf
d. Restart apache: sudo service apache2 restart
Access http://wordpress from your web browser.

Resources