software:webdesign
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
software:webdesign [2017/10/18 06:52] – [Setup Virtual hosts Ubuntu LAMP Wordpress] superwizard | software:webdesign [2019/07/13 07:30] (current) – [Sample Virtual Hosts] superwizard | ||
---|---|---|---|
Line 81: | Line 81: | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | ====== Check List for Adding Virtual Host ====== | ||
+ | |||
+ | From: | ||
+ | |||
+ | * Add database | ||
+ | * Add dns entry to registrar nameserver | ||
+ | * Add dns name to hosts | ||
+ | * Add files | ||
+ | * Add Apache2 virtualhost configuration / | ||
+ | * Add service to Apache2 | ||
+ | * Start service | ||
+ | |||
+ | |||
+ | |||
+ | ====== Apache Main Conf ====== | ||
+ | |||
+ | < | ||
+ | ServerAdmin you@example.com | ||
+ | |||
+ | # ServerName gives the name and port that the server uses to identify itself. | ||
+ | ServerName 0bf0b12d169b | ||
+ | |||
+ | # Virtual hosts | ||
+ | #Include conf/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ====== Sample Virtual Hosts ====== | ||
+ | |||
+ | < | ||
+ | < | ||
+ | # 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' | ||
+ | # 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 localhost | ||
+ | ServerAdmin madmin@madmin.yall | ||
+ | DocumentRoot / | ||
+ | |||
+ | ErrorLog ${APACHE_LOG_DIR}/ | ||
+ | CustomLog ${APACHE_LOG_DIR}/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | < | ||
+ | ServerName drupy.madmin.yall | ||
+ | ServerAlias *.madmin.yall | ||
+ | |||
+ | ServerAdmin madmin@madmin.yall | ||
+ | DocumentRoot / | ||
+ | |||
+ | ErrorLog ${APACHE_LOG_DIR}/ | ||
+ | CustomLog ${APACHE_LOG_DIR}/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | < | ||
+ | ServerName services.madmin.yall | ||
+ | ServerAlias *.madmin.yall | ||
+ | |||
+ | ServerAdmin madmin@madmin.yall | ||
+ | DocumentRoot / | ||
+ | |||
+ | ErrorLog ${APACHE_LOG_DIR}/ | ||
+ | CustomLog ${APACHE_LOG_DIR}/ | ||
+ | |||
+ | Alias /blog / | ||
+ | < | ||
+ | Options FollowSymLinks | ||
+ | AllowOverride Limit Options FileInfo | ||
+ | DirectoryIndex index.php | ||
+ | Order allow,deny | ||
+ | Allow from all | ||
+ | </ | ||
+ | < | ||
+ | Options FollowSymLinks | ||
+ | Order allow,deny | ||
+ | Allow from all | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ====== Common Apache Misconfigurations ====== | ||
+ | |||
+ | From: https:// | ||
+ | |||
+ | < | ||
+ | NameVirtualHost *:80 | ||
+ | |||
+ | # This is wrong. No matching NameVirtualHost some.domain.com line. | ||
+ | < | ||
+ | # Options and stuff defined here. | ||
+ | </ | ||
+ | |||
+ | # This would be correct. | ||
+ | < | ||
+ | ServerName some.domain.com | ||
+ | # Options and stuff defined here. | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== Setup up Apache2 for multiple virtual hosts (websites) ====== | ||
+ | |||
+ | From: https:// | ||
+ | |||
+ | Also: https:// | ||
+ | |||
+ | < | ||
+ | |||
+ | Remember to add or remove site with | ||
+ | |||
+ | sudo a2ensite | ||
+ | sudo a2dissite | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Name-based hosts on more than one IP address. | ||
+ | Note | ||
+ | |||
+ | Any of the techniques discussed here can be extended to any number of IP addresses. | ||
+ | |||
+ | The server has two IP addresses. On one (172.20.30.40), | ||
+ | |||
+ | Listen 80 | ||
+ | |||
+ | # This is the " | ||
+ | ServerName server.example.com | ||
+ | DocumentRoot "/ | ||
+ | |||
+ | < | ||
+ | DocumentRoot "/ | ||
+ | ServerName www.example.com | ||
+ | |||
+ | # Other directives here ... | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | DocumentRoot "/ | ||
+ | ServerName www.example.org | ||
+ | |||
+ | # Other directives here ... | ||
+ | </ | ||
+ | |||
+ | Any request to an address other than 172.20.30.50 will be served from the main server. A request to 172.20.30.50 with an unknown hostname, or no Host: header, will be served from www.example.com. | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ====== correct file permissions for wordpress ====== | ||
+ | |||
+ | From: https:// | ||
+ | |||
+ | < | ||
+ | When you setup WP you (the webserver) may need write access to the files. So the access | ||
+ | rights may need to be loose. | ||
+ | |||
+ | chown www-data: | ||
+ | find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x | ||
+ | find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r-- | ||
+ | |||
+ | After the setup you should tighten the access rights, according to Hardening WordPress all | ||
+ | files except for wp-content should be writable by your user account only. wp-content must | ||
+ | be writable by www-data too. | ||
+ | |||
+ | (sudo chown www-data: | ||
+ | |||
+ | chown < | ||
+ | chown www-data: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Wordpress Changing_The_Site_URL note addition of Port to site url ====== | ||
+ | |||
+ | From: http:// | ||
+ | |||
+ | |||
+ | < | ||
+ | Thsi re-writes the url that is sent to wordpress. must send back a compatible url for | ||
+ | source of browser request | ||
+ | </ | ||
====== Setup Virtual hosts Ubuntu LAMP Wordpress ====== | ====== Setup Virtual hosts Ubuntu LAMP Wordpress ====== | ||
Line 87: | Line 280: | ||
htaccess: https:// | htaccess: https:// | ||
+ | |||
+ | VirtualHosts: | ||
+ | |||
+ | ApacheCoreFeatures: | ||
< | < | ||
Line 167: | Line 364: | ||
</ | </ | ||
- | From: https:// | + | BindPorts: https:// |
< | < | ||
Line 187: | Line 384: | ||
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | ||
+ | |||
+ | |||
+ | < | ||
+ | # 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' | ||
+ | # 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 localhost | ||
+ | |||
+ | ServerAdmin mzztop@zzgxg.ubow | ||
+ | DocumentRoot / | ||
+ | |||
+ | # 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}/ | ||
+ | CustomLog ${APACHE_LOG_DIR}/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | < | ||
+ | ServerName drupal.zzgxg.ubow | ||
+ | ServerAlias *.zzgxg.ubow | ||
+ | |||
+ | ServerAdmin mzztop@zzgxg.ubow | ||
+ | DocumentRoot / | ||
+ | |||
+ | ErrorLog ${APACHE_LOG_DIR}/ | ||
+ | CustomLog ${APACHE_LOG_DIR}/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | < | ||
+ | # Wordpress Site | ||
+ | ServerName services.zzgxg.ubow | ||
+ | ServerAlias *.zzgxg.ubow | ||
+ | |||
+ | ServerAdmin mzztop@zzgxg.ubow | ||
+ | DocumentRoot / | ||
+ | |||
+ | ErrorLog ${APACHE_LOG_DIR}/ | ||
+ | CustomLog ${APACHE_LOG_DIR}/ | ||
+ | |||
+ | Alias /blog / | ||
+ | < | ||
+ | Options FollowSymLinks | ||
+ | AllowOverride Limit Options FileInfo | ||
+ | DirectoryIndex index.php | ||
+ | Order allow,deny | ||
+ | Allow from all | ||
+ | </ | ||
+ | < | ||
+ | Options FollowSymLinks | ||
+ | Order allow,deny | ||
+ | Allow from all | ||
+ | </ | ||
+ | |||
+ | </ | ||
</ | </ | ||
Line 295: | Line 557: | ||
</ | </ | ||
- | ====== Changing_The_Site_URL ====== | ||
- | From: http:// | ||
====== Moving WordPress ====== | ====== Moving WordPress ====== | ||
Line 307: | Line 567: | ||
From: http:// | From: http:// | ||
+ | |||
+ | Tutorial: https:// | ||
+ | |||
software/webdesign.txt · Last modified: 2019/07/13 07:30 by superwizard