1更改权限
Fedora的文件夹权限更改
su root
ls -l
groups //查看当前登录用户的组内成员
groups gumu wheel //查看gliethttp用户所在的组,以及组内成员
whoami //查看当前登录用户名
useradd fuyun
passwd fuyun
vim /etc/sudoers
修改 /etc/sudoers 文件,找到下面一行,把前面的注释(#)去掉
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
#然后修改用户,使其属于root组(wheel),命令如下:
#usermod -g root fuyun
#修改完毕,现在可以用fuyun帐号登录,然后用命令 su - ,即可获得root权限进行操作。
fuyun ALL=(ALL) ALL
2VM共享文件夹
安装VMware tools
在虚拟机菜单中选择虚拟机——安装VMware Tools
然后打开文件管理器,会发现多了个VMware Tools,打开
解压VMware Tools.tar.gz,随便解压到一个地方,然后用在终端切换到解压后的目录,然后输入./vmware-install.pl即可
mkdir /mnt/cdrom
cd /mnt/cdrom
cp VMwareTools-10.2.5-8068393.tar.gz /usr/
cd /usr/
tar xvfz VMwareTools-10.2.5-8068393.tar.gz
vmware-tools-distrib/vmware-install.pl
vmware-hgfsclient //列出共享文件夹
vmhgfs-fuse /mnt/cdrom/ //即可将共享文件夹挂载到/mnt/cdrom下面
cp -r /mnt/cdrom/soft/php/ /usr/share/ //把共享文件夹拷入目标文件夹
3 设置虚拟目录
vim /etc/nginx/nginx.conf
location /www {
alias /usr/share/php/wwwphp/; #后面的"/"符号一定要带上
}
systemctl restart nginx.service
sudo -s mv /usr/share/php/wwwphp/ usr/share/
:w !sudo tee % //vim 强制保存退出
chmod 777 ptcms
4 不认PHP文件
dnf install php-fpm
service php-fpm start #启动php-fpm
vim /etc/nginx/nginx.conf
include /etc/nginx/default.d/*.conf; #如果上面包含这个文件则打开这个文件
vim /etc/nginx/default.d/php.conf
# pass the PHP scripts to FastCGI server
#
# See conf.d/php-fpm.conf for socket configuration
#
index index.php index.html index.htm;
location ~ \.(php|phar)(/.*)?$ {
fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;
fastcgi_intercept_errors on;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass php-fpm;
}
改为
vim /etc/nginx/default.d/w.conf
# wwwphp
location /w {
alias /usr/share/wwwphp/ptcms/;
}
location /ptcms/ {
root /usr/share/wwwphp;
index index.php index.html;
location ~ ^/ptcms/(.+\.php)$
{
try_files $uri =404;
fastcgi_intercept_errors on;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass php-fpm;
}
}
# ptcms
location /ptcms {
alias /usr/share/wwwphp/ptcms/;
}
location /ptcms/ {
root /usr/share/wwwphp;
index index.php index.html;
location ~ ^/ptcms/(.+\.php)$
{
try_files $uri =404;
fastcgi_intercept_errors on;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass php-fpm;
}
}
service nginx restart
service php-fpm restart
报错
See "systemctl status nginx.service" and "journalctl -xe" for details
//按照提示,执行此命令,查看错误原因
systemctl status nginx.service
nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor prese>
Drop-In: /usr/lib/systemd/system/nginx.service.d
└─php-fpm.conf
Active: failed (Result: exit-code) since Fri 2018-09-21 21:07:09 CST; 1min 5>
Process: 891 ExecStart=/usr/sbin/nginx (code=exited, status=