Ubuntu安装typecho博客
名称的来历Typecho 是由 type 和 echo 两个词合成的,来自于开发团队的头脑风暴Type,有打字的意思,博客这个东西,正是一个让我们通过打字,在网络上表达自己的pingtaiEcho,意思是回声、反馈、共鸣,也是PHP里最常见、最重要的函数,相信大部分PHP爱好者都是从 echo Hello,world!; 开始自己的PHP编程之路的。
Typecho 是国内开发者开发的一款开源免费的动态博客程序,可以运行在基于 PHP 环境的各种pingtai上官网:Typecho Official SiteGitHub:typecho: A PHP Blogging Platform.。
相比于同为动态博客并且广为人知的 WordPress 来说,Typecho 的一大特点就是 “精简”全部文件不足 500KB,但却也实现了完整的主题和插件支持博客程序很轻量,ZY占用也很低,原生支持 Markdown 语法。
属于省心并且简洁的博客类型安装所需环境#安装PHP所需插件#添加ppa源add-apt-repositoryppa:ondrej/phpaptinstallnginxphp7.4php7.4-mysqlphp7.4-fpm
tml#lsindex.nginx-debian.htmlindex.phpphp.php
troot4096Dec616:29./drwxr-xr-x3rootroot4096Dec616:01../
-rw-r--r--1rootroot612Dec616:01index.nginx-debian.html-rw-r--r--1rootroot20Dec616:29php.php
cho/releases/latest/download/typecho.zip
Resolvingmirrors.chenby.cn(mirrors.chenby.cn)...172.67.134.246,104.21.25.253,2606:4700:3032::ac43:86f6,...
Connectingtomirrors.chenby.cn(mirrors.chenby.cn)|172.67.134.246|:443...connected.HTTPrequestsent,awaitingresponse...302Found
Reusingexistingconnectiontomirrors.chenby.cn:443.HTTPrequestsent,awaitingresponse...200OKLength:610472(596K)[application/octet-stream]
Savingto:‘typecho.zip’typecho.zip100%[=======================================================================>]596.16K935KB/sin0.6s
2023-12-061.zip
Archive:typecho.zipinflating:LICENSE.txtcreating:admin/inflating:admin/editor-js.php
inflating:admin/table-js.phpinflating:admin/options-general.php******略******inflating:var/Widget/Contents/Page/Rows.php
inflating:var/Widget/Contents/Page/Admin.phpinflating:var/Widget/Contents/Page/Edit.phpinflating:var/Widget/XmlRpc.php
修改配置#修改NGINX配置vim/etc/nginx/nginx.conf#添加路由信息---------------略---------------if(-f$request_filename/index.html){
rewrite(.*)$1/index.htmlbreak;}if(-f$request_filename/index.php){
rewrite(.*)$1/index.php;}if(!-f$request_filename){rewrite(.*)/index.php;
}location~\.php${includesnippets/fastcgi-php.conf;fastcgi_passunix:/var/run/php/php7.4-fpm.sock;
fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;includefastcgi_params;
fastcgi_intercept_errorson;}---------------略---------------重启服务#设置开机自启
root@cby:~#systemctlenablenginxSynchronizingstateofnginx.servicewithSysVservicescriptwith/lib/systemd/systemd-sysv-install.
Executing:/lib/systemd/systemd-sysv-installenablenginx#重启NGINXroot@cby:~#systemctlrestartnginx
#查看状态root@cby:~#systemctlstatusnginx●nginx.service-Ahighperformancewebserverandareverseproxyserver
Loaded:loaded(/lib/systemd/system/nginx.service;enabled;vendorpreset:enabled)Active:active(running)sinceFri2023-12-0810:09:31CST;42sago
Docs:man:nginx(8)Process:632604ExecStartPre=/usr/sbin/nginx-t-q-gdaemonon;master_processon;(code=exited,status=0/SUCCESS)
Process:632605ExecStart=/usr/sbin/nginx-gdaemonon;master_processon;(code=exited,status=0/SUCCESS)
MainPID:632606(nginx)Tasks:5(limit:3943)Memory:112.5MCPU:108msCGroup:/system.slice/nginx.service
├─632606"nginx:masterprocess/usr/sbin/nginx-gdaemonon;master_processon;"├─632607"nginx:workerprocess"""""""""""""""""""""""""""""""""""""""""""""""""""""""
├─632608"nginx:workerprocess"""""""""""""""""""""""""""""""""""""""""""""""""""""""
├─632609"nginx:workerprocess"""""""""""""""""""""""""""""""""""""""""""""""""""""""
└─632610"nginx:workerprocess"""""""""""""""""""""""""""""""""""""""""""""""""""""""
Dec0810:09:31cbysystemd[1]:StartingAhighperformancewebserverandareverseproxyserver...Dec0810:09:31cbysystemd[1]:StartedAhighperformancewebserverandareverseproxyserver.
root@cby:~##设置开机自启root@cby:~#systemctlenablephp7.4-fpmSynchronizingstateofphp7.4-fpm.servicewithSysVservicescriptwith/lib/systemd/systemd-sysv-install.
Executing:/lib/systemd/systemd-sysv-installenablephp7.4-fpm#重启PHP-FPMroot@cby:~#systemctlrestartphp7.4-fpm
#查看状态root@cby:~#systemctlstatusphp7.4-fpm.service●php7.4-fpm.service-ThePHP7.4FastCGIProcessManager
Loaded:loaded(/lib/systemd/system/php7.4-fpm.service;enabled;vendorpreset:enabled)Active:active(running)sinceFri2023-12-0810:11:02CST;2sago
Docs:man:php-fpm7.4(8)Process:633187ExecStartPost=/usr/lib/php/php-fpm-socket-helperinstall/run/php/php-fpm.sock/etc/php/7.4/fpm/pool.
MainPID:633184(php-fpm7.4)Status:"Readytohandleconnections"Tasks:3(limit:3943)
Memory:11.0MCPU:64msCGroup:/system.slice/php7.4-fpm.service├─633184"php-fpm:masterprocess(/etc/php/7.4/fpm/php-fpm.conf)"""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""">
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""">
Dec0810:11:02cbysystemd[1]:StartingThePHP7.4FastCGIProcessManager...Dec0810:11:02cbysystemd[1]:StartedThePHP7.4FastCGIProcessManager.
root@cby:~#我的NGINX配置文件#NGINX配置文
events{worker_connections768;}http{sendfileon;tcp_nopushon;types_hash_max_size2048;
include/etc/nginx/mime.types;default_typeapplication/octet-stream;ssl_protocolsTLSv1TLSv1.1TLSv1.2TLSv1.3;#DroppingSSLv3,ref:POODLE
ssl_prefer_server_cipherson;access_log/var/log/nginx/access.log;error_log/var/log/nginx/error.log;
gzipon;log_formatmain{"@times
"remote_port":"$remote_port","scheme":"$scheme","request_uri":"$request_uri",
"request_method":"$request_method","request_time":"$request_time",
"request_length":"$request_length","response_status":"$status",
"body_bytes_sent":"$body_bytes_sent","http_referer":"$http_referer",
"http_user_agent":"$http_user_agent","http_x_forwarded_for":"$http_x_forwarded_for",
"upstream_addr":"$upstream_addr","upstream_response_time":"$upstream_response_time",
"request_body":"$request_body"};server{listen80default_server;
listen[::]:80default_server;listen443sslhttp2;listen[::]:443sslhttp2;
ssl_certificate/ssl/cert.pem;ssl_certificate_key/ssl/cert.key;ssl_protocolsTLSv1.1TLSv1.2TLSv1.3;
ssl_ecdh_curveX25519:prime256v1:secp384r1:secp521r1;ssl_ciphersECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256;
ssl_prefer_server_cipherson;ssl_session_timeout10m;ssl_session_cacheshared:SSL:10m;
ssl_buffer_size2k;add_headerStrict-Transport-Securitymax-age=15768000;ssl_staplingon;
ssl_stapling_verifyon;error_log/var/logs/nginx-error.loginfo;access_log/var/logs/nginx-access.logmain;
ebian.html;server_name_;
location/{try_files$uri$uri/=404;}if(-f$request_filename/index.html){
rewrite(.*)$1/index.htmlbreak;}if(-f$request_filename/index.php){
rewrite(.*)$1/index.php;}if(!-f$request_filename){rewrite(.*)/index.php;
}location~\.php${includesnippets/fastcgi-php.conf;fastcgi_passunix:/var/run/php/php7.4-fpm.sock;
fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;includefastcgi_params;
fastcgi_intercept_errorson;}}include/etc/nginx/conf.d/*.conf;
inl