after successfully installing XAMP and then typo3 on my Mac, I set up a virtual host to avoid typing long URL when working on TYPO3.
I uncommented the http.conf line dealing with http-vhosts.conf so that I could set up virtual hosts, then I added my virtual host (called typo3dev) in httpd-vhosts.conf and I finally edited my hosts file accordingly.
So far so good, BUT now the issue that I'm having is that while pointing to the BE ( with http://typo3dev/typo3/ ) works just fine (I am able to log in and have fun in there), I cannot see the Frontend:
When pointing my browser to http://typo3dev/ , I get redirected to http://typo3dev/get-started/ where I get a Page Not Found error
Looking at the server error logs in I get that
$[Thu Jun 21 12:39:20 2012] [error] [client 127.0.0.1] File does not exist: /Applications/XAMPP/htdocs/typo3/introductionpackage-4.7.1/get-started
By the way, my hosts file looks like this:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 typo3dev
my httpd-vhosts.conf like that:
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/htdocs/typo3/introductionpackage-4.7.1"
ServerName typo3dev
</VirtualHost>
Thank you very much in advance for any help/ comment/ advice
Cheers
This looks like a RealURL/Apache configuration problem to me. Make sure that you allow .htaccess in your Apache configuration ...
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/htdocs/typo3/introductionpackage-4.7.1"
ServerName typo3dev
<Directory /Applications/XAMPP/htdocs/typo3/introductionpackage-4.7.1>
AllowOverride all
Order allow,deny
allow from all
</Directory>
</VirtualHost>
... or configure the RewriteRules directly in the VirtualHost section.
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/htdocs/typo3/introductionpackage-4.7.1"
ServerName typo3dev
<Directory /Applications/XAMPP/htdocs/typo3/introductionpackage-4.7.1>
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /Applications/XAMPP/htdocs/typo3/introductionpackage-4.7.1>
RewriteEngine On
RewriteRule ^/(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)$ - [L]
RewriteRule ^/(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
</Directory>
</VirtualHost>
Remember to reload / restart Apache after making changes to the configuration.
It's seems to me like you have installed the wrong package. Install only the source package because all other package is for demo. Also if you can avoid Apache. It's complicated and bloated. I can recommend lighttpd. It's much easier to configure especially with virtual domains.
Related
My setting is done and it works. Is it the correct way?
I have a Windows server and I installed XAMPP on it. Different domain would point to different IP address to the server. Also, every site runs https on this server. I go through a lot of tutorials and set up self-signed cert to each site.
Then, I configed the server with below setting.
These config works but I am not sure is it secure enough. I afraid that I missed something important.
I need the site to be reachable by below URL:
http://sitea.com (Will redirect to https://sitea.com)
http://www.sitea.com (Will also redirect to https://sitea.com)
https://sitea.com (This great)
https://www.sitea.com (Will force to use non-www version due to program needed- https://sitea.com)
My configuration is listed below. May I ask if it is good enough or if I missed something?
C:\xampp\apache\conf\extra\httpd-vhosts.conf:
<VirtualHost 192.168.242.121:80>
ServerName sitea.com
ServerAlias www.sitea.com
Redirect permanent / https://sitea.com/
</VirtualHost>
<VirtualHost 192.168.242.121:443>
DocumentRoot "S:/websites/sitea/"
ServerName sitea.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
SSLEngine on
SSLCertificateFile "ssl/sitea.com/server.crt"
SSLCertificateKeyFile "ssl/sitea.com/server.key"
AccessFileName .htaccess
ErrorLog "S:/websites/sitea/logs/error.log"
CustomLog "S:/websites/sitea/logs/access.log" common
<Directory S:/websites/sitea/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost 192.168.242.120:80>
ServerName siteb.com
ServerAlias www.siteb.com
Redirect permanent / https://siteb.com/
</VirtualHost>
<VirtualHost 192.168.242.120:443>
DocumentRoot "S:/websites/siteb/"
ServerName siteb.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
SSLEngine on
SSLCertificateFile "ssl/siteb.com/server.crt"
SSLCertificateKeyFile "ssl/siteb.com/server.key"
AccessFileName .htaccess
ErrorLog "S:/websites/siteb/logs/error.log"
CustomLog "S:/websites/siteb/logs/access.log" common
<Directory S:/websites/siteb/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
C:\Windows\System32\drivers\etc\hosts:
192.168.242.121 sitea.com www.sitea.com
192.168.242.120 siteb.com www.siteb.com
Thank you!
Enabling HTTPS on a website does not stop website vulnerabilities, it only secures data which is being transferred between the website server and client i.e. someone can not eaves drop on what the server and client are saying to each other. If a website has a vulnerability people will still be able to exploit it.
In your Apache configuration it looks like some of your apache configurations can be bypassed by accessing your website directly i.e. type it's IP address into a web browser. This would allow someone to bypass your mandated HTTPS for example. You should set up a redirect rule if you want to prevent against this.
I have setup virtual host on my localhost by using codeigniter and it is working fine. But I am not able to create wildcard subdomains. To add virtual host below are my steps on windows machine.
C:\Windows\System32\drivers\etc\hosts.txt
In this host.txt I have added below line
127.0.0.1 localhost.com
I am using xampp .I have added below lines in httpd-vhosts.conf file.
D:\xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost localhost.com:80>
DocumentRoot "D:/xampp/htdocs/adeptra"
ServerName localhost.com
ServerAlias localhost.com
<Directory "D:/xampp/htdocs/adeptra">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/adeptra"
ServerName localhost.com
ServerAlias *.localhost.com
<Directory "D:/xampp/htdocs/adeptra">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
Below is my .htaccess code to remove index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
So now my question is, is it really possible to create wildcard subdomains in localhost? If yes, then please help me in this regard. Any help would be greatly appreciated.
A similar question has already been asked and answered here. Basically, no you cannot create subdomains on localhost. You need to create a local domain which is explained in the linked answer.
I would like to have multiple domains going to the same EC2 instance. All will have same IP. I have setup multiple vhost files as domain1.com and domain2.com. I do not have anything special in any htaccess files or in the vhost files. I have the domains through GoDaddy, they are pointed to the EC2 IP. The issue I have is that both domain 1 and 2 go to the same folder and show the same index.html in the browser.
As per https://help.ubuntu.com/lts/serverguide/httpd.html I see that httpd.conf does not exist anymore and I do not see anything in apache2.conf for ghosts.
(As you can see the commented out things I have tried)
* NOT using rout 53, I do not want to use this, unless I have too*
vhost files:
(domain 1)
#SSLStaplingCache shmcb:/tmp/stapling_cache(128000)
SSLStaplingCache shmcb:${APACHE_RUN_DIR}/ssl_stapling_cache(128000)
<VirtualHost *:80>
ServerAdmin me#localhost
ServerName domain1.com
ServerAlias www.domain1.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
SSLUseStapling on
RewriteEngine on
#RewriteRule domain1.com\/$ http://domain1.com [NC]
RewriteCond %{SERVER_NAME} =domain1.com [OR]
RewriteCond %{SERVER_NAME} =domain1.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
(domain 2)
<VirtualHost *:80>
ServerAdmin me#gmail.com
ServerName domain2.com
ServerAlias www.domain2.com
DocumentRoot /var/www/html/domain2.com
# ServerPath "/domain2.com/"
# RewriteEngine On
# RewriteRule "^(/domain2.com/.*)" "/html/domain2.com$1"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/domain2.com>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
#RewriteEngine on
#RewriteRule domain2.com\/$ http://domain2.com/index.php [NC]
</VirtualHost>
default-ssl.conf file:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin me8#gmail.com
ServerName domain1.com
DocumentRoot /var/www/html/domain1.com
*********** EDIT ****************
apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2017-09-18T15:09:02
sudo apachectl configtest
Syntax OK
I have completed "sudo a2ensite" command on vhost files and restarted apache after them
******* EDIT ****************
in hosts:
127.0.0.1 localhost
127.0.1.1 domain1.com
127.0.1.2 domain2.com
You should provide more details:
What Instance/LAMP are you using?
Are you configuring vhost correctly?
For Bitnami stacks, for example, you should add the correct add the following line to the end of /opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf:
Include "/path to your configuration file.conf”
restart apache:
$sudo /opt/bitnami/ctlscript.sh restart apache
For plain Ubuntu,(after having apache installed) you should include your configuration file as below:
/etc/apache2/sites-available/example.com.conf
ensure to enable your virtual host file:
$sudo a2ensite example.com.conf
restart apache:
$sudo service apache2 restart
So, after making a new instance I was able to set up multiple vhosts.They are all working. The issue must have been the let's encrypt cert. I will backup my configuration and try let's encrypt on this the instance. I will report my findings to this posting. Thank you all for your help on this.
I have a server with the following virtual host defined :
<VirtualHost *:80>
DocumentRoot /dev/null
ServerName www.originaldomain.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+\.)?originaldomain.com
ReWriteRule ^.*$ http://www.destinationdomain.com [L,QSA,R=301]
</VirtualHost>
This successfully redirects www.originaldomain.com and originaldomain.com to www.destinationdomain.com.
However I now to additionally redirect www.originaldomain2.com and originaldomain2.com to destinationdomain.com. As an Apache novice I am unsure how best to achieve this. Any advice appreciated.
Add a ServerAlias for each of your new domains.
ServerAlias www.originaldomain2.com
ServerAlias originaldomain2.com
I have Windows 7 + Zend server
In httpd.conf file i have:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin keyne#localhost
ServerName local-izbori.bg
ServerAlias *.local-izbori.bg
DocumentRoot "C:\Program Files\Zend\Apache2\htdocs\izbori-www"
<Directory 'C:\Program Files\Zend\Apache2\htdocs\izbori-www'>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
in windows host file:
127.0.0.1 local-izbori.bg
And in my .htaccess file:
Options +FollowSymLinks
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css|php|doc|docx|pdf|swf|htm|php|htc)$ index.php
url rewrite work find, ex: local-izbori.bg/members/register/
but dynamic subdomain, like http://ruse.local-izbori.bg/ruse return: Server not found
is there any way to do all subdomain to go to index.php ?
Look into wildcard subdomains. In order for them to work you need to add that subdomain to your DNS.
I asume you are on windows. Unfortunately windows does not support wildcard definition so you will have to add a line for each subdomain to your hosts file.