How to access wampserver 2.5 localhost in LAN - wamp

I have a windows 10 PC with wampserver 2.5 and I want to access it on my phone. I can get to 192.168.22.3/phpmyadmin using my mobile phone but not in localhost or any other vhosts like 192.168.22.3/wordpress. I have already edited the
# offlineonline tag - don't remove
Require all granted
Require ip 192.168.22
and I still get the 403 Forbidden on my mobile when accessing 192.168.22.3/wordpress

If your server is, for example, 192.168.1.254 and you want access from, for example, 192.168.1.5 or everywhere like public IPs or free dns services, you have to edit the file c:\wamp\alias\phpmyadmin.conf and change
<IfDefine APACHE24>
Require local
</IfDefine>
in
<IfDefine APACHE24>
Require all granted
</IfDefine>
my file:
Alias /phpmyadmin "c:/wamp/apps/phpmyadmin4.1.14/"
# to give access to phpmyadmin from outside
# replace the lines
#
# Require local
#
# by
#
# Require all granted
#
<Directory "c:/wamp/apps/phpmyadmin4.1.14/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
<IfDefine APACHE24>
Require all granted
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from localhost ::1 127.0.0.1
</IfDefine>
php_admin_value upload_max_filesize 128M
php_admin_value post_max_size 128M
php_admin_value max_execution_time 360
php_admin_value max_input_time 360
</Directory>

Related

Django - No video supported format and MIME type found

When I run python manage.py runserver the videos on a webpage work.
I deployed the web with apache2 and instead of the videos I see
No video with supported format and MIME type found.
Did I omit something when deploying the web? When I deployed it the first time it worked,
but now it is not working.
Here is my /etc/apache2/sites-available/001-default.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerName video.xyz.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
Alias /static /home/pd/pd_videowebapp/static
<Directory /home/pd/pd_videowebapp/static>
Require all granted
</Directory>
Alias /media /home/pd/pd_videowebapp/media
<Directory /home/pd/pd_videowebapp/media>
Require all granted
</Directory>
<Directory /home/pd/pd_videowebapp/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess django-app2 python-path=/home/pd/pd_videowebapp python-home=/home/pd/pd_videowebapp/env lang='en_US.UTF-8' locale='en_US.UTF-8'
WSGIProcessGroup django-app2
WSGIScriptAlias / /home/pd/pd_videowebapp/mysite/wsgi.py
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Django site on Ubuntu 18.04 with Apache2 not working after installing SSL

I'm trying to deploy my Djang(1.10) application on Ubuntu 18.04 with Apache2 using mode_wsgi, the site was working perfectly well before setting up the SSL, but when I install the SSL certificate from Let'sEncrypt using certbot the is not loading anymore.
Here's my configurations:
Project folder path:
/home/abdul
Http configuration:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName www.orderfetchers.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
Alias /static /home/abdul/Fetchors/static
<Directory /home/abdul/Fetchors/static>
Require all granted
</Directory>
Alias /media /home/abdul/Fetchors/media
<Directory /home/abdul/Fetchors/media>
Require all granted
</Directory>
<Directory /home/abdul/Fetchors/Fetchors>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
#WSGIScriptAlias / /home/abdul/Fetchors/Fetchors/wsgi.py
#WSGIDaemonProcess django_app python-path=/home/abdul/Fetchors python-home=/home/abdul/Fetchors/venv
#WSGIProcessGroup django_app
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.orderfetchers.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Here's Https Configuration:
<IfModule mod_ssl.c>
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName www.orderfetchers.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
Alias /static /home/abdul/Fetchors/static
<Directory /home/abdul/Fetchors/static>
Require all granted
</Directory>
Alias /media /home/abdul/Fetchors/media
<Directory /home/abdul/Fetchors/media>
Require all granted
</Directory>
<Directory /home/abdul/Fetchors/Fetchors>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/abdul/Fetchors/Fetchors/wsgi.py
WSGIDaemonProcess django_app python-path=/home/abdul/Fetchors python-home=/home/abdul/Fetchors/venv
WSGIProcessGroup django_app
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/www.orderfetchers.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.orderfetchers.com/privkey.pem
</VirtualHost>
</IfModule>
tl;dr: Check your firewalls (port 443), and use online tutorials on configs (below).
Ok so I had the exact same error that you did - my site had been working fine on port 80 with Apache2 and Django 1.10 on an Ubuntu box, and when I followed a guide for LetsEncrypt, my site would take forever to load before timing out. I am assuming that the question in your post is how to stop your site from just timing out and actually get it to load.
In my case, I was lucky because I was merely an idiot who had forgotten to open port 443 on the AWS Security Group for my Ubuntu box. However, I had some additional config that may help you:
settings.py
# SSL support
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
# session expire at browser close
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
# wsgi scheme
os.environ['wsgi.url_scheme'] = 'https'
wsgi.py
os.environ['HTTPS'] = "on"
These configs were found and compiled with the help of these reference sites (which may also help you):
https://simpleisbetterthancomplex.com/tutorial/2016/05/11/how-to-setup-ssl-certificate-on-nginx-for-django-application.html
https://www.pdxpixel.com/blog/2014/02/04/setting-up-django-site-ssl-apache-mod_wsgi-mod_ssl/
https://docs.djangoproject.com/en/dev/topics/security/#ssl-https
Without more understanding of what your system is, it's difficult to help more precisely, but this is what I found useful, so hopefully it helps.

Flask app on non-root url of website with Apache2

I have a Flask app that I would like to host on a subdomain / non-root url of our lab website. For example, I want mylab.com/portal to lead to the flask app. I followed numerous guides but I keep getting a 404 error.
My Directory structure:
/var/www/
-html/
-Stuff for mylab.com
-FlaskApp/
-FlaskApp.wsgi
-FlaskApp/
-__init__.py
-static/
-templates/
-...
FlaskApp.wsgi:
#!/usr/bin/python3
activate_this = '/home/cogsci-cnddcollab/FlaskApp/venv/bin/activate_this.py'
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0, '/var/www/FlaskApp')
from FlaskApp import app as application
/etc/apache2/sites-available/000-default.conf
WSGIRestrictStdout Off
WSGIScriptReloading On
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName mylab.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
Redirect permanent / https://mylab.com/
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
<Directory "/var/www/html">
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
## FlaskApp
WSGIDaemonProcess FlaskApp_wsgi user=cogsci-cnddcollab group="domain users" threads=5
WSGIScriptAlias /portal /var/www/FlaskApp/FlaskApp.wsgi
<Directory /var/www/FlaskApp/FlaskApp/>
WSGIProcessGroup FlaskApp_wsgi
WSGIApplicationGroup %{GLOBAL}
Require all granted
</Directory>
Alias /portal/static /var/www/FlaskApp/FlaskApp/static
<Directory /var/www/FlaskApp/FlaskApp/static>
Require all granted
</Directory>
Alias /portal/templates /var/www/FlaskApp/FlaskApp/templates
<Directory /var/www/FlaskApp/FlaskApp/templates>
Require all granted
</Directory>
</VirtualHost>
Now, when I restart the apache2 service and go to mylab.com/portal, I am hit with a 404 error. I have added APPLICATION_ROOT=/portal to my config.py file.
Any help will be greatly appreciated.

phpmyadmin forbidden in Red Hat Enterprise Linux running on Amazon Web Services EC2

I am unable to access phpmyadmin in my server. I'm getting Forbidden.
Os version : Red Hat Enterprise Linux Server release 7.3 (Maipo)
I have checked answers in stackoverflow but, I'm unable to resolve my issue.
I installed phpmyadmin using command line.
running phpmyadmin Version information: 4.5.4.1
I have modified values in /etc/httpd/conf.d/phpMyAdmin.conf
My server is running on Amazon Web Services free tier.
here is the content present in phpMyAdmin.conf
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
# <IfModule mod_authz_core.c>
# Apache 2.4
# <RequireAny>
# Require ip 127.0.0.1
# Require ip ::1
# </RequireAny>
# </IfModule>
# <IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
# Deny from All
Allow from all
# Allow from 127.0.0.1
# Allow from ::1
# AllowOverride all
# Require all granted
# </IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/lib/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/frames/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
can you tell me what version of apache you are using apache 2.4 or apache 2.2 .
assuming 2.4
add to you httpd.conf
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
AllowOverride All
</Directory>
your below settings is restricting your access from browser .
Order Deny,Allow
Deny from All
Allow from ::1
Restart your httpd (apache)

Django, Apache2 and Nginx : Long loading time

I use Django as a technology for my website. Let's say that the domain name I use is example.com.
I use Apache2 as my main web server and Nginx to serve static files.
I first installed Apache and tested it. It worked perfectly (Without css and other static files, just the html).
I then installed Nginx (I have never used it before today) and this is where I encountered problems. Indeed when I want to access my website I get the html well as before. But the loading continues and the static files are not recovered.
I do not see any error in the Mozilla terminal.
Here is "Site-available" configuration :
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin contact#example.com
DocumentRoot /var/www/my_site
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
apache.conf :
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
#<Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>
# Configuration for Django application
WSGIScriptAlias / /var/www/my_site/site/wsgi.py
WSGIPythonPath /var/www/my_site
<Directory var/www/my_site/my_site>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
# FQDN
ServerName example.com
My Nginx config :
server {
listen 8000;
server_name localhost;
access_log /var/log/nginx/aa8000.access.log;
error_log /var/log/nginx/aa8000.error.log;
location / {
index index.html index.htm;
}
location ^/static/ {
autoindex on;
root /var/www/my_site/allstatic/;
}
}
And to finish my Django setting for static files :
STATIC_URL = 'http://example.com:8000/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
'/var/www/my_site/static/',
]
STATIC_ROOT = '/var/www/my_site/allstatic'
Nothing in Nginx error log or even in access log.
Edit : Finally I only use apache and it works.
There is what I added in apache conf:
Alias /favicon.ico /var/www/my_site/allstatic/favicon/favicon.ico
Alias /media/ /var/www/my_site/media/
Alias /static/ /var/www/my_site/allstatic/
<Directory /var/www/my_site/allstatic>
Require all granted
</Directory>
<Directory /var/www/my_site/media>
Require all granted
</Directory>
I suggest you add static (and if you need it, media) sections to your apache file like the example at https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/modwsgi/#serving-files in your apache.conf
And are you hosting more than one site? If not, don't use the sites-available; just turn off virtual hosting and don't enable anything in the sites-enabled directory.