nginx SSL PEM_read_bio:壞的結束行
在嘗試再次啟動nginx時,在我們的服務器上安裝中間證書給了我以下錯誤:
該文件的結尾看起來不錯,但問題是一半通過它。不知怎的,串聯連接在一起:
這只需要一個換行來解決:
1
2
3
|
(SSL: error:0906D066:PEM routines:PEM_read_bio:bad end line)
|
1
2
3
|
-----END CERTIFICATE----------BEGIN CERTIFICATE-----
|
1
2
3
4
|
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
|
| 軟體 | 版本 | |
| PHP | php5.4 | |
| WEB | nginx | |
| FRAMEWORK | Laravel5.0 | |
| DB | mariaDB | |
| VM | vmware8 | (2015.10.05 Vmware 11安裝無法選擇套件 進入以下步驟會有問題 ) |
| OS | CentOS7 | (選擇網站伺服器安裝,mariadb,php ) |
| Laravel5.0_Vmdk |
| (click me download vmdk(vmare8 )for Laravel 5.0 ) |
| (contain : nginx+php5.4+mariadb) |
yum update
yum install wget
yum install epel-release //更新後才可執行 sudo yum install php-mcrypt*
sudo yum install php-mcrypt* //laravel 會使用到的套件
//mariadb install
yum install mariadb-server mariadb
sudo systemctl start mariadb
第一次安裝
mysql -u root mysql -p (enter)
password : ( 直接 enter 第一次不需密碼 )
設定密碼
SET PASSWORD FOR 'root'@'localhost' = PASSWORD ('你的密碼');
設定誰可以進入資料庫
grant all privileges on *.* to root@1.2.3.4 identified by '你的密碼';
( 某人可以從1.2.3.4使用root進入)
視個人需求是否要修改port號
修改完記得要重啟
修改 mariadb port
/etc/my.cnf
//php install
No match for argument: php-mysql centos无法安装php-mysql模块
解决方案:
可能是epel源问题:
1.获取php7.0的yum源
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
(若出現異常跳過 沒有安裝跡象 ,則分開各別裝 )
(centos 內建 php5.4)
ex : yum install php-fpm
ex : yum install php
ex : yum install php-mysql
(centos 如果要安裝 更高php版本 7.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
How to Install PHP 7.0, 7.1, 7.2
sudo vi /etc/php.ini
/尋找 memory 修改記憶體配置 改為 512MB , 原本是128M
sudo vi /etc/php-fpm.d/www.conf
修改listen = /var/run/php-fpm/php-fpm.sock
;user = apache
user = nginx
;group = apache
group = nginx
listen.owner = nginx
listen.group = nginx
listen.mode = 0666
sudo systemctl start php-fpm
systemctl enable php-fpm.service
以下為補充
( laravel 5.1 need php5.5.9 + )
若使用 Laravel 5.1 的朋友需使用底下安裝步驟(php5.6)
//php5.6使用
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
vi /etc/yum.repos.d/remi.repo
找到標題是 [remi-php56] 將 enabled=0 改為 1
( 以上找不到就自動省略 )
//nginx install
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install nginx
centos8
假設安裝遇問題 添加以下
cat << EOF > /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/8/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
EOF
開通80port服務
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
vi /etc/nginx/conf.d/default.conf
將內容整個砍掉 ,複製貼上底下內容即可
( 注記得修改 root /usr/share/nginx/html/S1/public 位置)
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html/S1/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;
}
}
視個人需求是否要修改port號
修改完記得要重啟
修改 nginx port
/etc/nginx/conf.d/php.conf
修改 mariadb port
/etc/my.cnf
systemctl start nginx
systemctl status nginx
systemctl enable nginx.service
//Laravel install
cd /usr/share/nginx/html/
wget http://down.golaravel.com/laravel/laravel-v5.0.22.zip
unzip laravel-v5.0.22.zip
mv laravel-v5.0.22 Laravel
sudo chmod -R 775 Laravel
sudo chown -R nginx.nginx Laravel
systemctl restart nignx
這裡記住一定用sudo 去下cmd , 不要以為用root就不使用sudo
設定SELinux
vi /etc/selinux/config
由原本 #SELINUX=enforcing 改為 SELINUX=disabled
SELinux是 Security Enhanced Linux (安全加強的 Linux) 的縮寫,
他並不是一個防火牆的軟體,而是一個『針對檔案系統權限作更細部規劃的一個模組』。
假設到新電腦上安裝,複製原本的laravel資料夾過去
看log一直顯示 could not be opened failed to open stream permission denied 時
或是出現 0.0.0.0:8843 failed (13: Permission denied)
執行它即可
sudo setenforce 0
或是在 nginx.conf 最上方
user nginx 改為 root
參考
https://blog.51cto.com/waxyz/5336419
#include<iostream>
#include<conio.h>
#include<string>
#include<fstream>
using namespace std;
/* The grammar follwed by this analyser is : you have to give a blank to differentite between two different entities, for eg
instead of writing "int c=a+b;", write it as "int c = a + b ;".
To execute this program first create an "input.txt" file where the program is written or specify the path of the file which has
to be analysed, after compiling an "output.txt" file will be created where you have stored the program.
*/
bool keycheck(string str)
{
string keyword[] ={"int","main()","float","if"};
int flag=0;
if(!(str[0]>=97 && str[0]<=122))
return false;
for(int i=0;i<4;i++)
{
if(str == keyword[i])
{
flag = 1;
break;
}
}
if(flag == 1)
return true;
else
return false;
}
string opcheck(string str)
{
string reloperators[8] ={"=","==",">","<",">=","<="};
string mathoperators[5] ={"+","*","/","-","%"};
string operators[4]={"{","}",";",","};
int flag1=0,flag2=0,flag=0;
for(int i=0;i<4;i++)
{
if(str == operators[i])
{
flag = 1;
break;
}
}
if(flag == 1)
{
return "operator";
}
else
{
for(int i=0;i<8;i++)
{
if(str == reloperators[i])
{
flag1 = 1;
break;
}
}
if(flag1 == 1)
{
return "relational operator";
}
else
{
for(int i=0;i<5;i++)
{
if(str == mathoperators[i])
{
flag2 =1;
break;
}
}
if(flag2 == 1)
return "mathematical operator";
else
return "error";
}
}
}
int ischar(char c)
{
if((c>=65 && c<=90) || (c>=97 && c<=122))
return 1;
else
return 0;
}
int isnum(char c)
{
if(c>=48 && c<=57)
return 1;
else
return 0;
}
int isnums(string str)
{
int flag=0;
for(int i = 0;i<str.length();i++)
{
if(!isnum(str[i]))
{
if(str[i] != 46)
{
flag=1;
break;
}
}
}
if(flag == 1)
return 0;
else
return 1;
}
int isidentifier(string str)
{
int flag =0;
for(int i=1;i<str.length();i++)
{
if(!ischar(str[i]))
{
if(!isnum(str[i]))
{
if(str[i] != 95)
{
if(str[i] == 91)
{
i++;
for(;str[i]!= 93;)
{
if(!isnum(str[i]))
{
flag =1;
break;
}
i++;
}
}
else
{
flag = 1;
}
if(flag ==1)
break;
}
}
}
}
return flag;
}
int exc( string str1 )
{
int flag=0;
bool check;
string str="",strch,strline;
for(int j=0;j<str1.length();j++)
{
if(str1[j] ==' ' || str1[j]=='\t')
{
if(str != "")
{
if(ischar(str[0]))
{
check = keycheck(str);
if(check)
{
cout<<str<<"\t --> reserved word\n";
}
else
{
flag = isidentifier(str);
if(flag == 1)
{
cout<<str<<"\t --> error\n";
flag = 0;
}
else
{
cout<<str<<"\t --> identifier\n";
}
}
}
else
{
if(isnum(str[0]))
{
if(isnums(str))
cout<<str<<"\t -->number\n";
else
cout<<str<<"\t -->error\n";
}
else
{
strch = opcheck(str);
if(strch == "error")
cout<<str<<"\t -->"<<strch<<"\n";
else
cout<<str<<"\t -->"<<strch<<"\n";
}
}
}
str="";
}
else
{
str=str+str1[j];
}
}
return 0 ;
}
int main()
{
string str="",strch,strline,str1;
char a[520];
cin.get(a,520);
exc(a);
system("pause");
}
Access-Control-Allow-Origin * in that application, but you can put in front of the server a reverse proxy, the error can avoided with a header rewrite.server {
listen 80;
server_name www.mydomain.com;
access_log /var/log/nginx/www.mydomain.com.access.log;
error_log /var/log/nginx/www.mydomain.com.error.log;
location / {
proxy_pass http://127.0.0.1:8080;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Origin 'http://domain.com';
}
}
註:下面的說明中,我把使用的人分成兩端,一種我們叫"客服人員",也就這個網站的負責接待的人員,也就是負責回答問題的人。另一種叫"客戶",他們是來到這個網站的訪客,想要問問題或尋求協助的人。
yum install httpd
systemctl start httpd
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
chkconfig httpd on
[root@lucifer ~]# yum install mod_dav_svn subversion
[root@lucifer ~] vim /etc/httpd/conf/httpd.conf —— 作所需修改並存檔 [root@lucifer ~] service httpd start [root@lucifer ~] chkconfig httpd on
[root@lucifer ~] cd /etc/httpd/conf.d/
[root@lucifer ~] vim subversion.conf
# 有需要的話,請確定你移除這兩行的註釋
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
# 加入下列內容來支援基本驗證,並將 Apache 指向實際放置版本庫的地方。
<Location /repos>
DAV svn
SVNPath /var/www/svn/repos
AuthType Basic
AuthName "Subversion repos"
AuthUserFile /etc/svn-auth-conf
Require valid-user
</Location>
[root@lucifer ~] htpasswd -cm /etc/svn-auth-conf yourusername New password: Re-type new password: Adding password for user yourusername [root@lucifer ~] htpasswd -m /etc/svn-auth-conf anotherusername New password: Re-type new password: Adding password for user anotherusername
[root@lucifer ~] cd /var/www/ —— 或者你在上面所指定的路徑 [root@lucifer ~] mkdir svn [root@lucifer ~] cd svn [root@lucifer ~] svnadmin create repos [root@lucifer ~] chown -R apache.apache repos [root@lucifer ~] service httpd restart
AuthzSVNAccessFile /etc/svn-acl-conf
<Location /repos>
DAV svn
SVNPath /var/www/svn/repos
AuthzSVNAccessFile /etc/svn-acl-conf
AuthType Basic
AuthName "Subversion repos"
AuthUserFile /etc/svn-auth-conf
Require valid-user
</Location>
注意是 使用 SVNPath 非 SVNParentPath
[版本庫名稱:版本庫路徑] 用戶 = 存取權
[framework:/] john = r joe = rw
[groups] staff = joe, george [framework:/] john = r @staff = rw
[/] * = r
cd /etc/httpd/conf.d/
vim subversion.conf
AuthzSVNAccessFile /etc/svn-acl-conf
在 etc 下新增一檔案 叫 svn-acl-conf
svn-acl-conf 內容設定如下 [repos:/] john = rw (表示john 擁有整個資料夾瀏覽及編輯權限 ) [repos:/f1/f2] Mary = r ( 表示 Mary 只允許瀏覽 /f2 下資料夾內容 ) 小心資料夾名稱後不要加到斜線了 例如 : f1/f2/
vi /etc/sysconfig/svnserve //修改路逕
# OPTIONS is used to pass command-line arguments to svnserve.
#
# Specify the repository location in -r parameter:
OPTIONS="-r /var/www/svn/repos"
netstat -nltp //查詢目前服務的阜號 例如 : 8891
kill 8891 //砍掉目前服務的 port
svnserve -d -r /var/www/svn/repos //重新繫結 svn 目錄
systemctl restart httpd //重啟 http 服務
shell (node.js)
npm install chinese-conv
shell (jspm for browser)
jspm install npm:chinese-conv
ES2015 (browser/node.js)
import {tify, sify} from 'chinese-conv';
// 轉成正體中文
let text = tify('所谓知己知彼百战不殆,作为星际2职业选手,他们在平时练习中不仅要练好自己的本族,还会经常选择其他两个族进行练习,这样可以更加了解本族之外两个种族的运营流程、弱点、真空期等。因此不只有Flash,全世界许多职业选手都会在练习时偶尔使用下别的种族,这也是他们众多练习手段的一种。');
console.log(text);
node.js
var chineseConv = require('chinese-conv');
var text = chineseConv.tify('所谓知己知彼百战不殆,作为星际2职业选手,他们在平时练习中不仅要练好自己的本族,还会经常选择其他两个族进行练习,这样可以更加了解本族之外两个种族的运营流程、弱点、真空期等。因此不只有Flash,全世界许多职业选手都会在练习时偶尔使用下别的种族,这也是他们众多练习手段的一种。');
//轉成簡體
var text = chineseConv.sify('轉成簡體測試');
console.log(text);