Category Archives: Hosting

Add Custom Virtual Host in laragon

  1. Add a sub folder in laragon root.
  2. Rewrite .conf in D:\laragon\etc\apache2\sites-enabled
    Change DocumentRoot and Directory
  3. Reload Apache

Example:

Reference

  1. https://stackoverflow.com/questions/63318438/how-to-set-custom-virtual-host-name-in-laragon
  2. Tool
    https://github.com/bantya/CmdVirtualHost

New domain for Apache

https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts

Commands

Change permission:

Restart apache:

 

htaccess Redirection with URL param

 

Change upload size limit by htaccess

This solution works even in  shared server.

Cross-Origin Resource Sharing (CORS) (Ajax Cross Domain issue)

PHP:

.htaccess

Enable header module on Apache:

IIS:

Image 4

Reference:

  1. http://blog.toright.com/posts/3205/%E5%AF%A6%E4%BD%9C-cross-origin-resource-sharing-cros-%E8%A7%A3%E6%B1%BA-ajax-%E7%99%BC%E9%80%81%E8%B7%A8%E7%B6%B2%E5%9F%9F%E5%AD%98%E5%8F%96-request.html
  2. http://stackoverflow.com/questions/10640596/header-set-access-control-allow-origin-in-htaccess-doesnt-work
  3. http://stackoverflow.com/questions/869092/how-to-enable-mod-rewrite-for-apache-2-2

DNS Configurations

Server A -> sub domain -> Server B

目前Domain是指到Server A, 但是想要開一個subdomain指到Server B

  1. 取得Server B的IP
  2. 在Server B中建一個sub domain
  3. 在Server A中建一個sub domain
  4. 修改#3 sub domain的A record, 指到#1的IP

GSuit -> Godaddy

  1. 如果網址是在gsuite買的,在Gsuite控制台會有地方查詢到網域相關的資料,並且有登入godaddy domain manager的帳密和網址
  2. 在Godaddy另外開一個帳號建立網站
  3. #2完成後,在網域的地方可以查到server的IP
  4. 在#1的domain manager中,把A record指到#3的IP

Reference: