Created
March 18, 2020 09:57
-
-
Save mdmunir/7ba57bab1984d2eff1a49780f50d6e29 to your computer and use it in GitHub Desktop.
Apache + socket.io
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <VirtualHost *:80> | |
| ServerName dee-basic.test | |
| Redirect permanent "/" "https://dee-basic.test/" | |
| </VirtualHost> | |
| <VirtualHost *:443> | |
| ServerName dee-basic.test | |
| DocumentRoot /var/www/dee-basic/web | |
| SSLEngine on | |
| SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt | |
| SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key | |
| # Jangan lupa enable proxy_wstunnel | |
| # sudo a2enmod proxy_wstunnel | |
| RewriteEngine On | |
| RewriteCond %{REQUEST_URI} ^/socket.io [NC] | |
| RewriteCond %{QUERY_STRING} transport=websocket [NC] | |
| RewriteRule /(.*) ws://localhost:3001/$1 [P,L] | |
| ProxyRequests on | |
| ProxyPassMatch ^/socket http://localhost:3001 | |
| ProxyPassReverse ^/socket http://localhost:3001 | |
| <Directory /var/www/dee-basic/web/> | |
| Options Indexes FollowSymLinks | |
| AllowOverride All | |
| Require all granted | |
| </Directory> | |
| IncludeOptional php73-fcgi.conf | |
| </VirtualHost> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Redirect to local php-fpm if mod_php is not available | |
| <IfModule !mod_php7.c> | |
| <IfModule proxy_fcgi_module> | |
| # Enable http authorization headers | |
| <IfModule setenvif_module> | |
| SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1 | |
| </IfModule> | |
| <FilesMatch ".+\.ph(ar|p|tml)$"> | |
| SetHandler "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost" | |
| </FilesMatch> | |
| <FilesMatch ".+\.phps$"> | |
| # Deny access to raw php sources by default | |
| # To re-enable it's recommended to enable access to the files | |
| # only in specific virtual host or directory | |
| Require all denied | |
| </FilesMatch> | |
| # Deny access to files without filename (e.g. '.php') | |
| <FilesMatch "^\.ph(ar|p|ps|tml)$"> | |
| Require all denied | |
| </FilesMatch> | |
| </IfModule> | |
| </IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment