laravel8 5分鐘保證完成

 












軟體版本
PHPphp7.3
WebServicenginx
FRAMEWORKLaravel8
OScentos7.2


1.安裝相關套件
yum update yum install wget yum install epel-release //更新後才可執行 sudo yum install php-mcrypt* sudo yum install php-mcrypt* //laravel 會使用到的套件 sudo yum install php-xml //laravel 會使用到的套件

2.安裝 nginx 
//nginx install rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install nginx
開通80port服務
iptables -I INPUT -p tcp --dport 80 -j ACCEPT vi /etc/nginx/conf.d/default.conf 將內容整個砍掉 ,複製貼上底下內容即可 ( 注記得修改 root /usr/share/nginx/html/{app-name}/public 位置) server { listen 80; server_name localhost; root /usr/share/nginx/html/APP-name/public; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; proxy_connect_timeout 159s; proxy_send_timeout 600; proxy_read_timeout 600; proxy_buffer_size 64k; proxy_buffers 16 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; proxy_pass_header Set-Cookie; proxy_redirect off; proxy_hide_header Vary; proxy_set_header Accept-Encoding ''; proxy_ignore_headers Cache-Control Expires; proxy_set_header Referer $http_referer; proxy_set_header Host $host; proxy_set_header Cookie $http_cookie; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }


3.安裝PHP7.3 安裝 php5.4 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm sudo yum install php-mbstring //laravel 會使用到的套件 yum install php php-mysql php-fpm 更新到 php7.2 yum install epel-release yum-utils -y yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm yum-config-manager --enable remi-php72 yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql -y 更新到 php7.3 sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm sudo yum -y install epel-release yum-utils sudo yum-config-manager --disable remi-php54 sudo yum-config-manager --enable remi-php73

4.修改PHP設定檔 修改 php設定檔 /etc/php7/fpm/php-fpm.d/www.conf 有些是放在 /etc/php-fpm.d/www.conf 如果你是用nginx就改成nginx 是apache就改apache user = nginx group = nginx listen = /var/run/php7.3-fpm.sock listen.owner = nginx listen.group = nginx listen.mode = 0660

5.調整nginx conf設定 location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php7.3-fpm.sock; fastcgi_pass 調整為 /var/run/php7.3-fpm.sock

6.安裝 composer sudo yum install php-cli php-zip wget unzip 找一位置放置 composer-setup php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" 並在此位置下 執行 sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

7.使用composer建立專案 composer create-project laravel/laravel app-name --ignore-platform-reqs php artisan --version //確認安裝版本 Laravel Framework 8.28.1

CheapSSL for Java SSL 教學

 

CheapSSL Certificates

環境&工具

  • Linux
  • nginx
  • openssl
  • keytool

流程步驟

1.   創造csr及私鑰.key(要保留好私鑰key) 官方教學   

I.     openssl req -newkey rsa:2048 -nodes -keyout {Name}.key -out {Name}.csr  

II.   填相關資料Common Name 要填確實,以便確認網域 若為wildcard 可填寫為*.domain.com  

2.   透過CheapSSL 網頁上傳csr至憑證商

3.   使用nginx驗證 將憑證商給的驗證文件置於憑證商要求位置

I.     http://domain.com/.well-known/pki-validation/fileauth.txt

4.   待憑證商審核通過

5.   CheapSSL訂單頁面 Download PKCS7(.p7b)

6.   .p7b轉為cer

I.     openssl pkcs7 -print_certs -in {Name}.p7b -out {Name}.cer


 

7.   .cer及私鑰.key結合為pfx (IIS使用)

I.     openssl pkcs12 -export -out {Name}.pfx -inkey {Name}.key -in {Name}.cer -password pass:{ .pfx password };

8.   pfx轉為JKS (java使用)

I.     keytool -importkeystore -srckeystore {Name}.pfx -destkeystore {Name}.jks -noprompt -srcstoretype PKCS12 -deststoretype JKS -deststorepass {JKS password} -srcstorepass {.pfx password}