熱門文章

顯示具有 nginx 標籤的文章。 顯示所有文章
顯示具有 nginx 標籤的文章。 顯示所有文章

2020年2月24日 星期一

[筆記] 在nginx同時裝laravel 跟wordpress

原本以為很簡單設定location就好,沒想到一直回傳404

laravel 
  • path: /var/www/html/blog 
  • web address: www.example.com

wordpress
  • path: /var/www/html/wordpress
  • web address: www.example.com/wordpress

server {

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html index.php;

        server_name doki-friends.com www.doki-friends.com;
        root /var/www/html/blog/public;


        location / {
                root /var/www/html/blog/public;
                try_files $uri $uri/  /index.php?$query_string;
        }

        location ^~ /wordpress {
                alias /var/www/html/wordpress;
                try_files $uri $uri/ @wordpress;
                location ~ \.php$ {
                        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME $request_filename;
                        include fastcgi_params;
                }
        }

        location @wordpress{
                rewrite /wordpress/(.*)$ /wordpress/index.php?/$1 last;
        }

        # pass PHP scripts to FastCGI server
        #
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        }
}


2019年9月21日 星期六

[筆記] 免費使用Oracle cloud vps並打開port 80端口


Oracle 最近宣布提供個人終身免費VPS,但是我在架設網站的過程中遇到了一些困難,nginx怎麼連都連不上去,就寫下來分享一下

直接進到Oracle Cloud Infrastructure裡面,照著圖片點選

Click instance



Click Virtual Cloud Network



Click subnet

Click default security list


Remove all rules and add a ingress rule like this

Remove all rules and add a Egress rule like this


這樣還不行!!因為oracle的ubunt有內建ip table,我們把iptables刪除

ssh進去後輸入
sudo apt remove iptables

啟用root登入 Enable root login

  1. sudo passwd root
  2. sudo nano /etc/ssh/sshd_config
    • PermitRootLogin prohibit-password -> PermitRootLogin yes
    • PasswordAuthentication no -> PasswordAuthentication yes
  3. sudo service ssh restart



這樣就設定完成了

接著安裝nginx請參考這篇

另外,提醒一下要注意免費額度400是否有在扣款,Instance shape必須是VM.Standard.E2.1.Micro才是免費的

VM.Standard.E2.1---> Paid
VM.Standard.E2.1.Micro ---> Free