When exactly are protons attracted to other protons and neutrons? When 


*

*proton and proton

*neutron and neutron

*proton and neutron


are attracted to each other or repelled from each other in terms of strong interaction (ignoring electromagnetic interaction)?
I read that in s-state:
"proton and proton" and "neutron and neutron" are attracted to each other only when their spin has different sign (antiparallel). If their spins are same sign (parallel) they are repelled from each other.
As to "proton and neutron" it is visa versa - attracted if same-sign spins (+1/2 and +1/2, or -1/2 and -1/2) repelled if different-sign spins (+1/2 and -1/2).
My questions: is this rule universal for any pair, or for p, d and other orbitals (states) the rules are different?
 A: Universal over short distances. 
It works for any orbital nucleons, and is what causes the magic nuclei (e.g. why Helium, Neon etc. are so stable, and why nucleons bound together as an alpha particle are a common ejection from a nucleus). A nuclei where all nuclei are in this spin pairing bound state experiences a stronger attraction and therefore requires more energy to break apart (in this case, from Coulomb repulsion).
I'm not sure if the first bit is intended as a question, but you're correct that the proton-neutron bound state requires the same spin states, and the proton-proton and neutron-neutron requires opposite spin states. 
This is because the target is a net 0 spin (as this is the highest energy binding we can achieve). Protons have -1/2 spin, Neutrons have +1/2 spin. Same spin states are added, opposite spin states are subtracted.
-p-n- = (-1/2) + (+1/2) = 0
-p-p- = (-1/2) - (-1/2) = 0
-n-n- = (+1/2) - (+1/2) = 0
(As a bit of a side note, -p-p- is made a bit more complex by having Coulomb repulsion energy higher than this spin pairing attraction energy and so diprotons (-p-p-) aren't really a 'thing', whereas dineutrons (-n-n-) and proton-neutron couplings (-p-n-) don't suffer from this Coulomb repulsion, but all of this comes from the same principle.)
Some sources and links and stuff like that:
https://arxiv.org/ftp/arxiv/papers/1512/1512.00314.pdf - Paper with evidence for dineutrons.
http://www.sjsu.edu/faculty/watkins/protonrepulsion.htm - A clear explanation San Jose State University (which admittedly I've never heard of) on a webpage that really looks like it was designed in 2001, but the information on it is legitimate.
https://en.wikipedia.org/wiki/Talk%3ADiproton#Diproton_stability_vs_Dineutron_stability - A somewhat nicely apt discussion on a Wikipedia page if you'd prefer a less 'formal' link.
