I am trying to get Xampp to work in https, but I am having a few issues.
What I have done so far:
mod_ssl.so is loaded
php_openssl.dll is loaded
DocumentRoot in httpd-ssl.conf was changed from C:/xampp/htdocs to C:/xampp/ as this is where all of the directories of my sites are.
Do I need to change the server name in httpd-ssl.conf?
Edit: do I need to add virtual host in httpd-vhosts.conf on port 443 as well as 80? Also, do Xampp come with a built in SSL cert etc.?
I think the best way is creating a VirtualHost for each project you're developing.
Otherwise, you would need change the DocumentRoot for the project you're developing at the time.
So, you can change "httpd-vhosts.conf" file and create a VH for port 80 redirecting all the requests to a VH for port 443 (if you want to disable HTTP only), like this:
• HTTP
<VirtualHost *:80>
ServerName yoursite.your.domain
Redirect / https://yoursite.your.domain/
</VirtualHost>
• HTTPS
<VirtualHost *:443>
ServerName yoursite.your.domain:443
#in your case you're not using htdocs, so DocumentRoot be like
DocumentRoot "C:\xampp\yourproject"
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, PUT, GET, DELETE, OPTIONS"
Header always set Access-Control-Allow-Headers "Content-Type"
</IfModule>
#the same here
<Directory "C:\xampp\yourproject">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
#check your absolute path bellow
SSLEngine on
SSLCertificateFile "C:\xampp\apache\conf\ssl.crt\server.crt"
SSLCertificateKeyFile "C:\xampp\apache\conf\ssl.key\server.key"
</VirtualHost>
About the certificate, I think XAMPP actually come with a built in SSL certificate, but, even it didn't came, you can generate it using his tools. You can see a lot of tutorials in the internet about this.
Related
I have a Symfony API REST, enabled in my apache production server, which uses HTTPS and certified A+ security by Querys SSL test.
Via a POST route https://hooks-api.com/hooks, the API returns a url property, generated with $request->generateUrl method of Symfony Request.
The problem is that the API always generates a http:// URL since Symfony does not recognize that the server is using HTTPS (tested with $request->getScheme & $request->getPort).
After some researches, it seems that the phpinfo prints a Appache HTTP Configuration with REQUIRE_SCHEME http, and all the stuff for SSL is missing like HTTPS on & SSL_TLS_SNI.
I have created a new production environnement on my own local, with the same virtual host config: it works !
But I still don't understand why the production server does not work... Here is my config :
<VirtualHost *:80>
ServerName api.hooks
Redirect 308 / https://prod.api.hooks/
</VirtualHost>
<VirtualHost *:443>
ServerName prod.api.hooks
SSLEngine on
SSLCertificateKeyFile "${SRVROOT}/conf/key/private.key"
SSLCertificateFile "${SRVROOT}/conf/key/certificate.crt"
Header set Access-Control-Allow-Origin "*"
Header always set Content-Security-Policy "default-src 'none'!"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Strict-Transport-Security "max-age=31536000; includeSubdomains;"
Header always set X-Content-Type-Options "nosniff"
DocumentRoot C:/wamp64/www/production/hooks/public
<Directory "C:/wamp64/www/production/hooks/public">
AllowOverride None
Require all granted
FallbackResource /index.php
</Directory>
<Directory "C:/wamp64/www/production/hooks/public/bundles">
FallbackResource disabled
</Directory>
</VirtualHost>
I know there have been a lot of questions regarding this topic, but I still was not able to get it to work.
I've set up a Wordpress site and a virtual host for that site locally on my notebook (via Wamp 3.1) and now I want to access it from another PC on the same network. On the localhost everything works fine.
My httpd-vhosts.conf file looks like this:
# Virtual Hosts
#
#Wamp
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#Hp1
<VirtualHost *:80>
ServerName hp1.local
DocumentRoot "d:/wamp64/www/hp1"
<Directory "d:/wamp64/www/hp1">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
Require ip 192.168.100.76
</Directory>
</VirtualHost>
I've added 192.168.100.88 hp1.local (the ip of notebook) to my PC's host file. 192.168.100.76 is the ip of my PC.
I can ping my PC from my notebook and vice versa.
I've tried to access the site via
http://192.168.100.88
and
http://hp1.local
But to no avail. Not even a 403 or anything, just
Error: network timeout
Edit:
Thinks I've tried:
Put an inbound rule for port 80 in place (on my PC)
Deactivated the firewall (on my PC)
Added Apaches httpd.exe to my hosts firewall exceptions (solution)
Windows Firewall is likely blocking incoming connections from Apache. Add an exception for Wamp's incoming traffic (or just turn it off, but doing so would be bad for security).
I am using XAMPP in Windows.I want to set vhost for my symfony project so I have set the vhost in apache through (httpd-vhosts.conf) file as :
# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:80
# This is the configuration for drberg.com
Listen 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
ServerName drberg.com.local
DocumentRoot "D:/xampp/htdocs/DrBerg.com/web"
DirectoryIndex index.php
<Directory "D:/xampp/htdocs/DrBerg.com/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf "D:/xampp/htdocs/DrBerg.com/web/sf"
<Directory "D:/xampp/htdocs/DrBerg.com/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
So I can't access it it's not opening anything also when I access my symfony project through manual link so it redirects me to my localhost as :
http://localhost/DrBerg.com/web/
So it redirects me to :
http://localhost/xampp/
Set in your hosts (in WINDOWS/system32/drivers/etc/) your ServerName:
127.0.0.1 drberg.com.local
(it works immediately after save this file)
and point to:
http://drberg.com.local
(use http:// because sometimes chrome send the address to google.com instead go there)
and don't use localhost in the ServerName because XAMPP filter this word (local can be).
I configured zend framework 3 through composer on remote debian server. I added virtual host to etc/apache2/sites-available/mysite.conf like below but it shows just "It works!" page instead of zf3 public. Do anyone knows hos to solve it?
<VirtualHost *:80>
ServerName zfapp.localhost
DocumentRoot /var/www/mysite/skeleton-application/public
<Directory /var/www/mysite/skeleton-application/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</Directory>
Check the following:
Have you enabled the site on the remote Debian server. To enable the site you should use a2ensite mysite
The ServerName directive should correspond the the HTTP hostname in the HTTP request. When you are dereferencing a URL on the remote server, the hostname part in the browser should correspond with the ServerName. It is unlikely you are using zfapp.localhost since most OS's have reserved host entries of 127.0.0.1 for any localhost derivative.
I need to set my url for my site to appear as mydomain.com/ and have apache recognize that as the webroot.
Currently my url looks like:
###.###.##.##/laravel/public
and I want it to become:
mydomain.com/
This is the first site I've worked on from scratch, so I'm not completely sure what information I should include here.
Current apache httpd.conf:
NameVirtualHost *:80
NOTE: NameVirtualHost cannot be used without a port specifier
(e.g. :80) if mod_ssl is being used, due to the nature of the
SSL protocol.
VirtualHost example:
Almost any Apache directive may go into a VirtualHost container.
The first VirtualHost section is used for requests without a known
server name.
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot /var/www/html/foo_bar/public
ServerName foo.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
<Directory /var/www/html/foo/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
</VirtualHost>
First you'll need to edit your httpd.conf (usually located somewhere like /etc/apache2/conf).
Look for a line like <Directory "/var/www">. This is telling apache the root directory from which you want to work. /var/www in your case will be whatever directory laravel/public is living in on your websever currently.
If you change that line to <Directory "/var/www/laravel/public"> (assuming /var/www is where your laravel app is), save the file and restart apache, then you should be serving mydomain.com from inside laravel/public.